Groups | Blog | Home
all groups > dotnet interop > april 2004 >

dotnet interop : Problems when creating an Exchange offline address book (OAB)


Benny Hest
4/29/2004 11:38:17 PM
Hi.

I try to create an OAB with LDAP and ADSI. I set all these properties:

offLineABContainers
offLineABServer
offlineABSchedule
offlineABStyle
instanceType
doOABVersion
msExchOABFolder
legacyExchangeDN

- and still I only get an:

System.Runtime.InteropServices.COMException (0x8007202F): A constraint
violation occurred.

When I commit the transaction. Below is some of my code (c#):

DirectoryEntry offlineList =
oOfflineAddrListContainer.Children.Add("CN=" + customerDomain, "msExchOAB");
DirectoryEntry sample =
oOfflineAddrListContainer.Children.Find("CN=source.domain.com");

byte[] copiedSchedule =
(byte[])sample.Properties["offlineABSchedule"].Value;

// Properties:
offlineList.Properties["offLineABContainers"].Add("CN=" + customerDomain +
"," + GlobalAdrList);
offlineList.Properties["offLineABServer"].Value = offlineABServer + "," +
defaultNC;
offlineList.Properties["offlineABSchedule"].Add(copiedSchedule);
offlineList.Properties["offlineABStyle"].Value = 1;
offlineList.Properties["instanceType"].Value = 4;
offlineList.Properties["doOABVersion"].Value = 0;
offlineList.Properties["msExchOABFolder"].AddRange(new object[] { 0 });
offlineList.Properties["legacyExchangeDN"].Value =
"/o=ExchangeHotel/cn=addrlists/cn=oabs/cn=" + customerDomain;
offlineList.Properties["systemFlags"].Value = 1610612736;
// offlineList.Properties["siteFolderGUID"].Add(tGUID);
offlineList.Properties["siteFolderServer"].Value = siteFolderServer + "," +
defaultNC;
offlineList.CommitChanges(); // this line fails.


Hope you can help me.


Cheers,
Benny

Steven Secker
5/14/2004 9:01:31 AM
First problem might be an invalid value for offlineABContainers, so make
sure that the object identified by this distinguishedName actually
exists:

CN=" + customerDomain + "," + GlobalAdrList

If you've got a typo there, or if that object doesn't exist, you will
definitely get the "constraint violation" error.

Second problem might be in setting the systemFlags attribute. It's not a
mandatory attribute, so try skipping that and see if the error goes
away.

At present I'm searching for a way to set the systemFlags attribute from
VB. I can get it just fine, but if I try to set it (even if I try to set
it to the same value I just got from myObj.Get("systemFlags")), I get
the "constraint violation." Presumably this is because the value I'm
trying to set it to (1610612736 or 0x60000000) is a long integer.


*** Sent via Developersdex http://www.developersdex.com ***
AddThis Social Bookmark Button