Skip to content

Instantly share code, notes, and snippets.

@TBag
Created March 2, 2015 16:36
Show Gist options
  • Save TBag/df84f219ac0cdcc315f5 to your computer and use it in GitHub Desktop.
Save TBag/df84f219ac0cdcc315f5 to your computer and use it in GitHub Desktop.
CreateADUsersAndGroups method from Property Inspection Code Sample. Part of the AuthenticationHelper class found here: https://github.com/OfficeDev/Property-Inspection-Code-Sample/blob/master/PropertyManagerMyApp/PropertyManagerMyApp/Utils/AuthenticationHelper.cs
public async Task CreateADUsersAndGroups()
{
XmlDocument sampleData = new XmlDocument();
var sampleDataUrl = HttpContext.Current.Request.Url.Scheme + "://" + HttpContext.Current.Request.Url.Authority + "/Content/SampleData.xml";
sampleData.Load(sampleDataUrl);
this.client = await this.GetActiveDirectoryClient();
//VerifiedDomain defaultDomain = await this.GetTenantDefualtDomain();
String defaultDomainValue = System.Configuration.ConfigurationManager.AppSettings["DemoSiteCollectionOwner"].Split('@')[1];
await ParaseXmlAndCreateADGroups(sampleData);
await ParserXmlAndCreateADUsers(sampleData, defaultDomainValue);
return;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment