Iβm working on providing multiple tenants in a sharepoint, and itβs hard for me to understand if you can set the path to the directory of the user account to subscribe to the site using the sharepoint object model. I know that this can be done through powershell using the following cmdlet.
$sub = New-SPSiteSubscription $sub | Set-SPSiteSubscriptionConfig -UserAccountDirectoryPath "OU=AlpineBikeStore,OU=Hosting,DC=contoso,DC=com" -FeaturePack "50976ac2-83bb-4110-946d-95b4b6e90d42" -Confirm:$false
So far, I have the following code that will create a subscription to the site with the site and the default feature pack. However, I cannot figure out how to set the path to the OU of users in the active directory.
//Create a default admin site for this tenant var site = new SPSite("https://contoso.com/", userToken); //Create the subscription and assign the default admin site to it. var sub = SPSiteSubscription.Create(); sub.Add(site); //Get the feature pack and assign it to the subscription var featurePacks = SPSiteSubscriptionSettingsManager.Local.GetAllFeaturePacks(); var pack = featurePacks.SingleOrDefault(x => x.Id == Guid.Parse("50976ac2-83bb-4110-946d-95b4b6e90d42")); SPSiteSubscriptionSettingsManager.Local.AssignFeaturePackToSiteSubscription(pack, sub);
Any suggestions?
Nicholas J. Markkula
source share