public override void ReportExcludedObject(SyncObjectId objectId, DirectoryObjectErrorCode errorCode, ProcessingStage processingStage) { base.ReportExcludedObject(objectId, errorCode, processingStage); DirectoryObjectError directoryObjectError = new DirectoryObjectError(); directoryObjectError.ErrorCode = errorCode; directoryObjectError.ObjectId = objectId.ObjectId; directoryObjectError.ContextId = objectId.ContextId; directoryObjectError.ObjectClass = objectId.ObjectClass; directoryObjectError.ObjectClassSpecified = true; this.errors.Add(directoryObjectError); if (this.performanceCounterSession != null) { this.performanceCounterSession.IncrementUserError(); } }
public DirectoryObjectsAndLinks GetMsoRawObject(SyncObjectId syncObjectId, string serviceInstanceId, bool includeBackLinks, bool includeForwardLinks, int linksResultSize, out bool?allLinksCollected) { DirectoryObjectIdentity[] array = new DirectoryObjectIdentity[] { syncObjectId.ToMsoIdentity() }; DirectoryObject[] array2 = new DirectoryObject[1]; DirectoryLink[] array3 = new DirectoryLink[0]; DirectoryObjectError[] array4 = new DirectoryObjectError[0]; DirectoryObjectsAndLinks directoryObjectsAndLinks = new DirectoryObjectsAndLinks { NextPageToken = null, More = true }; byte[] msoSyncCookie = this.GetMsoSyncCookie(serviceInstanceId); GetDirectoryObjectsOptions?getDirectoryObjectsOptions = new GetDirectoryObjectsOptions?(GetDirectoryObjectsOptions.None); if (includeBackLinks) { getDirectoryObjectsOptions |= GetDirectoryObjectsOptions.IncludeBackLinks; } if (includeForwardLinks) { getDirectoryObjectsOptions |= GetDirectoryObjectsOptions.IncludeForwardLinks; } if (includeForwardLinks || includeBackLinks) { allLinksCollected = new bool?(true); } else { allLinksCollected = null; } while (directoryObjectsAndLinks.More) { GetDirectoryObjectsRequest request = new GetDirectoryObjectsRequest((directoryObjectsAndLinks.NextPageToken == null) ? msoSyncCookie : null, (directoryObjectsAndLinks.NextPageToken == null) ? array : null, (directoryObjectsAndLinks.NextPageToken == null) ? getDirectoryObjectsOptions : null, directoryObjectsAndLinks.NextPageToken); GetDirectoryObjectsResponse directoryObjects = this.SyncProxy.GetDirectoryObjects(request); if (directoryObjects.GetDirectoryObjectsResult.Objects != null && directoryObjects.GetDirectoryObjectsResult.Objects.Length != 0 && array2[0] == null) { directoryObjects.GetDirectoryObjectsResult.Objects.CopyTo(array2, 0); } if (allLinksCollected == true && directoryObjects.GetDirectoryObjectsResult.Links != null && directoryObjects.GetDirectoryObjectsResult.Links.Length != 0 && array3.Length <= linksResultSize) { if (array3.Length == linksResultSize) { allLinksCollected = new bool?(false); } else { int num = array3.Length; int num2 = array3.Length + directoryObjects.GetDirectoryObjectsResult.Links.Length; int num3 = Math.Min(linksResultSize, num2); if (num2 > linksResultSize) { allLinksCollected = new bool?(false); } Array.Resize <DirectoryLink>(ref array3, num3); Array.Copy(directoryObjects.GetDirectoryObjectsResult.Links, 0, array3, num, num3 - num); } } if (directoryObjects.GetDirectoryObjectsResult.Errors != null && directoryObjects.GetDirectoryObjectsResult.Errors.Length != 0) { Array.Resize <DirectoryObjectError>(ref array4, array4.Length + directoryObjects.GetDirectoryObjectsResult.Errors.Length); directoryObjects.GetDirectoryObjectsResult.Errors.CopyTo(array4, array4.Length - directoryObjects.GetDirectoryObjectsResult.Errors.Length); } directoryObjectsAndLinks.NextPageToken = directoryObjects.GetDirectoryObjectsResult.NextPageToken; directoryObjectsAndLinks.More = directoryObjects.GetDirectoryObjectsResult.More; } directoryObjectsAndLinks.Objects = ((array2 != null && array2[0] != null) ? array2 : new DirectoryObject[0]); directoryObjectsAndLinks.Links = array3; directoryObjectsAndLinks.Errors = array4; return(directoryObjectsAndLinks); }