• Share
    • Twitter
    • LinkedIn
    • Facebook
    • Email
  • Feedback
  • Edit
Show / Hide Table of Contents

ContactAddress

•
Version: 8
Some tooltip text!
• 1 minute to read
 • 1 minute to read
using SuperOffice;
using SuperOffice.CRM.Rows;

using(SuperOffice.SoSession session = SuperOffice.SoSession.Authenticate( "Sal1", "" ))
{
  OwnerContactLinkRow owns = new OwnerContactLinkRow.IdxOwnerContactLinkId( 1 );
  int contactId = owns.ContactId;
  Assert.IsTrue( contactId > 0, "Found owner contact ID" );
  ContactRow c = new ContactRow.IdxContactId( contactId );
  AddressRow a = AddressRow.CreateNew();
  a.Sentries.Add( c.Sentries ); // re-use contact sentry on the address
  a.OwnerId = c.ContactId;
  a.AtypeIdx = AddressType.ContactPostalAddress;
  a.Address1 = "line one-two-three";
  a.City = "Some city";
  a.Zipcode = "1234";
  a.Save();
  // contact update is allowed, but restricted address insert is allowed.

  // this will throw exception, since OwnerContact's name is protected by sentry
  c.Name = "new name";

  // this will also throw exception, since OwnerContact's contact row must not be deleted
  c.Delete();
}
In This Article
© SuperOffice. All rights reserved.
SuperOffice |  Community |  Release Notes |  Privacy |  Site feedback |  Search Docs |  About Docs |  Contribute |  Back to top