private static void AddADObject(ModifiedItem item) { var oguObject = item.OguObjectData; string[] rdns = SynchronizeHelper.GetOguObjectRdns(oguObject); string parentDN = string.Join(",", rdns, 1, rdns.Length - 1); ADHelper adHelper = SynchronizeContext.Current.ADHelper; using (DirectoryEntry parentEntry = parentDN.IsNullOrEmpty() ? adHelper.GetRootEntry() : adHelper.NewEntry(parentDN)) { parentEntry.ForceBound(); using (DirectoryEntry newEntry = WhatEverNewEntry(oguObject, parentEntry)) { ObjectSetterHelper.Convert(ObjectModifyType.Add, oguObject, newEntry); //item.ADObjectData = SynchronizeHelper.GetSearchResultByID(newEntry.NativeGuid, newEntry.ToADSchemaType()).ToADOjectWrapper(); if (SynchronizeContext.Current.IDMapper.NewIDMappingDictionary.ContainsKey(oguObject.ID) && SynchronizeContext.Current.IDMapper.NewIDMappingDictionary[oguObject.ID] == null) { SynchronizeContext.Current.IDMapper.NewIDMappingDictionary[oguObject.ID] = new IDMapping() { SCObjectID = oguObject.ID, ADObjectGuid = newEntry.NativeGuid, LastSynchronizedVersionTime = (DateTime)oguObject.Properties["VERSION_START_TIME"] }; } } } }