private void EnsurePortalPath(SyncTree syncTree, string ADPath, string portalParentPath)
{
// portalParentPath does not exist
if (!Node.Exists(portalParentPath))
{
// get parent AD object
string ADparentPath = syncTree.GetADParentObjectPath(ADPath);
// ensurepath
EnsurePortalPath(syncTree, ADparentPath, RepositoryPath.GetParentPath(portalParentPath));
}
// portalParentPath exists, so AD object should be synchronized here
// domain, container, orgunit
using (DirectoryEntry entry = syncTree.ConnectToObject(ADPath))
{
var guid = Common.GetADObjectGuid(entry, _config.GuidProp);
if (!guid.HasValue)
return;
SyncOneADObject(null, entry, (Guid)guid, ADObjectType.AllContainers, portalParentPath, CreateNewPortalContainer, UpdatePortalContainerProperties, syncTree);
}
}
// connect to the appropriate synctree AD corresponding to the domain of the requested object