/// <summary> /// Creates the instance. /// </summary> /// <param name="appSetting">The app setting.</param> /// <param name="oItemType">Type of the o item.</param> /// <returns></returns> public static RemoteProviderProxy CreateInstance(syncAppSetting appSetting, Outlook.OlItemType oItemType) { RemoteProviderProxy retVal = null; NetworkCredential cred = new NetworkCredential(); cred.UserName = appSetting.ibnPortalLogin; cred.Password = appSetting.ibnPortalPassword; SynchronizationService syncService = new SynchronizationService(); //enable session syncService.CookieContainer = new System.Net.CookieContainer(); string syncServiceUrl = appSetting.ibnPortalUrl; if (!syncServiceUrl.Contains(OutlookAddin.Resources.System_IbnSyncWebServicePath)) { Uri url = new Uri(syncServiceUrl); UriBuilder uriBuilder = new UriBuilder(); uriBuilder.Scheme = Uri.UriSchemeHttp; uriBuilder.Port = url.Port; uriBuilder.Host = url.Host; uriBuilder.Path = url.AbsolutePath + OutlookAddin.Resources.System_IbnSyncWebServicePath; syncServiceUrl = uriBuilder.ToString(); } syncService.Url = syncServiceUrl; //Authentificate syncService.SetCredentials(cred); //Set sync provider syncService.SetProviderTypeForSyncSession((OutlookAddin.SyncService.eSyncProviderType)oItemType); retVal = new RemoteProviderProxy(syncService); return(retVal); }
/// <summary> /// Creates the instance. /// </summary> /// <param name="appSetting">The app setting.</param> /// <param name="oItemType">Type of the o item.</param> /// <returns></returns> public static RemoteProviderProxy CreateInstance(syncAppSetting appSetting, Outlook.OlItemType oItemType) { RemoteProviderProxy retVal = null; NetworkCredential cred = new NetworkCredential(); cred.UserName = appSetting.ibnPortalLogin; cred.Password = appSetting.ibnPortalPassword; SynchronizationService syncService = new SynchronizationService(); //enable session syncService.CookieContainer = new System.Net.CookieContainer(); string syncServiceUrl = appSetting.ibnPortalUrl; if (!syncServiceUrl.Contains(OutlookAddin.Resources.System_IbnSyncWebServicePath)) { Uri url = new Uri(syncServiceUrl); UriBuilder uriBuilder = new UriBuilder(); uriBuilder.Scheme = Uri.UriSchemeHttp; uriBuilder.Port = url.Port; uriBuilder.Host = url.Host; uriBuilder.Path = url.AbsolutePath + OutlookAddin.Resources.System_IbnSyncWebServicePath; syncServiceUrl = uriBuilder.ToString(); } syncService.Url = syncServiceUrl; //Authentificate syncService.SetCredentials(cred); //Set sync provider syncService.SetProviderTypeForSyncSession((OutlookAddin.SyncService.eSyncProviderType)oItemType); retVal = new RemoteProviderProxy(syncService); return retVal; }