protected override IConfigDataProvider CreateSession() { ADSessionSettings sessionSettings = base.SessionSettings; IRecipientSession tenantOrRootOrgRecipientSession = DirectorySessionFactory.Default.GetTenantOrRootOrgRecipientSession(base.DomainController, true, ConsistencyMode.IgnoreInvalid, sessionSettings, 88, "CreateSession", "f:\\15.00.1497\\sources\\dev\\Management\\src\\Management\\Mobility\\Aggregation\\GetRemoteAccountSyncCache.cs"); string idStringValue = this.Identity.ToString(); ADUser aduser = (ADUser)base.GetDataObject <ADUser>(this.Identity.MailboxId, tenantOrRootOrgRecipientSession, null, new LocalizedString?(Strings.ErrorUserNotFound(idStringValue)), new LocalizedString?(Strings.ErrorUserNotUnique(idStringValue))); ADSessionSettings adSettings = ADSessionSettings.RescopeToOrganization(base.SessionSettings, aduser.OrganizationId, true); SubscriptionCacheAction cacheAction = SubscriptionCacheAction.None; if (this.ValidateCache) { cacheAction = SubscriptionCacheAction.Validate; } ExchangePrincipal userPrincipal = null; try { userPrincipal = ExchangePrincipal.FromLegacyDN(adSettings, aduser.LegacyExchangeDN, RemotingOptions.AllowCrossSite); } catch (ObjectNotFoundException exception) { base.WriteError(exception, ErrorCategory.InvalidArgument, this.Identity.MailboxId); } return(new CacheDataProvider(cacheAction, userPrincipal)); }
private static byte[] GetTestUserCacheInputBytes(string primarySmtpAddress, SubscriptionCacheAction cacheAction) { MdbefPropertyCollection mdbefPropertyCollection = new MdbefPropertyCollection(); mdbefPropertyCollection[2684485663U] = primarySmtpAddress; mdbefPropertyCollection[2684420099U] = (int)cacheAction; return(mdbefPropertyCollection.GetBytes()); }
public CacheDataProvider(SubscriptionCacheAction cacheAction, ExchangePrincipal userPrincipal) { SyncUtilities.ThrowIfArgumentNull("userPrincipal", userPrincipal); this.cacheAction = cacheAction; this.userPrincipal = userPrincipal; }
internal static bool TryTestUserCache(string databaseServer, string primarySmtpAddress, SubscriptionCacheAction cacheAction, out string failureReason, out uint cacheActionResult, out List <SubscriptionCacheObject> cacheObjects, out ObjectState objectState) { SyncUtilities.ThrowIfArgumentNullOrEmpty("databaseServer", databaseServer); SyncUtilities.ThrowIfArgumentNullOrEmpty("primarySmtpAddress", primarySmtpAddress); failureReason = null; cacheActionResult = 268435456U; cacheObjects = null; objectState = ObjectState.Unchanged; byte[] testUserCacheInputBytes = SubscriptionCacheClient.GetTestUserCacheInputBytes(primarySmtpAddress, cacheAction); byte[] array = null; using (SubscriptionCacheRpcClient subscriptionCacheRpcClient = new SubscriptionCacheRpcClient(databaseServer)) { try { array = subscriptionCacheRpcClient.TestUserCache(0, testUserCacheInputBytes); } catch (RpcException exception) { failureReason = Strings.CacheRpcExceptionEncountered(exception); return(false); } } MdbefPropertyCollection args = MdbefPropertyCollection.Create(array, 0, array.Length); int num; if (!RpcHelper.TryGetProperty <int>(args, 2835349507U, out num)) { failureReason = Strings.CacheRpcInvalidServerVersionIssue(databaseServer); return(false); } cacheActionResult = (uint)num; RpcHelper.TryGetProperty <string>(args, 2835415071U, out failureReason); byte[] buffer; if (RpcHelper.TryGetProperty <byte[]>(args, 2835480834U, out buffer)) { using (MemoryStream memoryStream = new MemoryStream(buffer)) { cacheObjects = (List <SubscriptionCacheObject>)SubscriptionCacheClient.binaryFormatter.Deserialize(memoryStream); } } if (RpcHelper.TryGetProperty <int>(args, 2835546115U, out num)) { objectState = (ObjectState)num; } return(true); }