Esempio n. 1
0
 // Token: 0x06000B53 RID: 2899 RVA: 0x0002DE04 File Offset: 0x0002C004
 internal static void ConfigureOrgExtension(string domain, string extensionId, bool isEnabled, bool isMandatory, bool isEnabledByDefault, ClientExtensionProvidedTo providedTo, string[] specificUsers)
 {
     OrgExtensionTable.ExecuteWebServicesAction(delegate
     {
         OrgExtensionTable.RequestData arg = new OrgExtensionTable.RequestData();
         ExchangeService exchangeService   = OrgExtensionTable.CreateExchangeServiceDelegate(domain, arg);
         if (exchangeService == null)
         {
             return;
         }
         ClientExtension clientExtension = new ClientExtension(0, 0, null, null, null, isEnabled, isMandatory, isEnabledByDefault, providedTo, (specificUsers == null) ? null : new StringList(specificUsers), string.Empty, string.Empty);
         exchangeService.SetClientExtension(new List <SetClientExtensionAction>
         {
             new SetClientExtensionAction(2, extensionId, clientExtension)
         });
     });
 }
Esempio n. 2
0
 // Token: 0x06000B52 RID: 2898 RVA: 0x0002DD30 File Offset: 0x0002BF30
 internal static void SetOrgExtension(string domain, SetClientExtensionActionId actionId, string extensionId, ExtensionData extensionData)
 {
     OrgExtensionTable.ExecuteWebServicesAction(delegate
     {
         OrgExtensionTable.RequestData arg = new OrgExtensionTable.RequestData();
         ExchangeService exchangeService   = OrgExtensionTable.CreateExchangeServiceDelegate(domain, arg);
         if (exchangeService == null)
         {
             return;
         }
         MemoryStream memoryStream = null;
         XmlWriter xmlWriter       = null;
         try
         {
             ClientExtension clientExtension = null;
             if (extensionData != null)
             {
                 memoryStream = new MemoryStream();
                 xmlWriter    = new XmlTextWriter(memoryStream, Encoding.UTF8);
                 extensionData.Manifest.WriteTo(xmlWriter);
                 xmlWriter.Flush();
                 memoryStream.Position = 0L;
                 clientExtension       = new ClientExtension(extensionData.Type.Value, extensionData.Scope.Value, memoryStream, extensionData.MarketplaceAssetID, extensionData.MarketplaceContentMarket, extensionData.IsAvailable, extensionData.IsMandatory, extensionData.IsEnabledByDefault, extensionData.ProvidedTo, (extensionData.SpecificUsers == null) ? null : new StringList(extensionData.SpecificUsers), extensionData.AppStatus, extensionData.Etoken);
             }
             exchangeService.SetClientExtension(new List <SetClientExtensionAction>
             {
                 new SetClientExtensionAction(actionId, extensionId, clientExtension)
             });
         }
         finally
         {
             if (xmlWriter != null)
             {
                 xmlWriter.Close();
             }
             if (memoryStream != null)
             {
                 memoryStream.Close();
             }
         }
     });
 }
Esempio n. 3
0
        // Token: 0x06000B51 RID: 2897 RVA: 0x0002DA14 File Offset: 0x0002BC14
        internal static Dictionary <string, ExtensionData> GetOrgExtensions(StringList requestedExtensionIds, string domain, bool shouldReturnEnabledOnly, bool isUserScope, string userId, StringList userEnabledExtensionIds, StringList userDisabledExtensionIds, out OrgExtensionTable.RequestData requestData, bool isDebug, out string orgMasterTableRawXml, bool retrieveOnly1_0 = false)
        {
            Dictionary <string, ExtensionData> dictionary       = new Dictionary <string, ExtensionData>(StringComparer.OrdinalIgnoreCase);
            Collection <ClientExtension>       clientExtensions = null;
            string orgRawXml = null;

            OrgExtensionTable.RequestData requestDataSave = new OrgExtensionTable.RequestData();
            requestData = requestDataSave;
            OrgExtensionTable.ExecuteWebServicesAction(delegate
            {
                Stopwatch stopwatch = new Stopwatch();
                stopwatch.Start();
                ExchangeService exchangeService = OrgExtensionTable.CreateExchangeServiceDelegate(domain, requestDataSave);
                if (exchangeService == null)
                {
                    return;
                }
                if (OrgExtensionTable.GetClientExtensionTimeoutIsAllowed())
                {
                    exchangeService.Timeout = 30000;
                }
                requestDataSave.CreateExchangeServiceTime   = stopwatch.ElapsedMilliseconds;
                GetClientExtensionResponse clientExtension2 = exchangeService.GetClientExtension(requestedExtensionIds, shouldReturnEnabledOnly, isUserScope, userId, userEnabledExtensionIds, userDisabledExtensionIds, isDebug);
                stopwatch.Stop();
                requestDataSave.GetClientExtensionTime = stopwatch.ElapsedMilliseconds - requestDataSave.CreateExchangeServiceTime;
                requestDataSave.ExchangeServiceUri     = exchangeService.Url;
                string text;
                if (exchangeService.HttpResponseHeaders.TryGetValue("request-id", out text))
                {
                    requestDataSave.EwsRequestId = text.Replace("-", string.Empty);
                }
                else
                {
                    requestDataSave.EwsRequestId = "NotFound";
                }
                clientExtensions = clientExtension2.ClientExtensions;
                if (isDebug && !string.IsNullOrWhiteSpace(clientExtension2.RawMasterTableXml))
                {
                    try
                    {
                        byte[] bytes = Convert.FromBase64String(clientExtension2.RawMasterTableXml);
                        orgRawXml    = Encoding.UTF8.GetString(bytes);
                    }
                    catch (FormatException innerException)
                    {
                        throw new OwaExtensionOperationException(innerException);
                    }
                    catch (ArgumentException innerException2)
                    {
                        throw new OwaExtensionOperationException(innerException2);
                    }
                }
            });
            if (clientExtensions != null)
            {
                foreach (ClientExtension clientExtension in clientExtensions)
                {
                    try
                    {
                        ExtensionData extensionData = ExtensionData.CreateFromClientExtension(clientExtension);
                        if (!retrieveOnly1_0 || !(extensionData.SchemaVersion != SchemaConstants.SchemaVersion1_0))
                        {
                            ExtensionData extensionData2;
                            if (!dictionary.TryGetValue(extensionData.ExtensionId, out extensionData2) || !(extensionData.SchemaVersion < extensionData2.SchemaVersion))
                            {
                                dictionary[ExtensionDataHelper.FormatExtensionId(extensionData.ExtensionId)] = extensionData;
                            }
                        }
                    }
                    catch (OwaExtensionOperationException ex)
                    {
                        OrgExtensionTable.Tracer.TraceError <OwaExtensionOperationException>(0L, "skipping an org extension because it cannot be parsed. Exception: {0}", ex);
                        ExtensionDiagnostics.Logger.LogEvent(ApplicationLogicEventLogConstants.Tuple_OrgExtensionParsingFailed, null, new object[]
                        {
                            "ProcessOrgExtensions",
                            ExtensionDiagnostics.GetLoggedExceptionString(ex)
                        });
                    }
                }
            }
            orgMasterTableRawXml = orgRawXml;
            return(dictionary);
        }