当前位置: 首页>>代码示例>>C#>>正文


C# ExchangeService类代码示例

本文整理汇总了C#中ExchangeService的典型用法代码示例。如果您正苦于以下问题:C# ExchangeService类的具体用法?C# ExchangeService怎么用?C# ExchangeService使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


ExchangeService类属于命名空间,在下文中一共展示了ExchangeService类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: CreateConnection

        public static ExchangeService CreateConnection(string emailAddress)
        {
            // Hook up the cert callback to prevent error if Microsoft.NET doesn't trust the server
            ServicePointManager.ServerCertificateValidationCallback =
                delegate(Object obj, X509Certificate certificate, X509Chain chain, SslPolicyErrors errors)
                {
                    return true;
                };

            ExchangeService service = null;
            if (!string.IsNullOrEmpty(Configuration.ExchangeAddress))
            {
                service = new ExchangeService();
                service.Url = new Uri(Configuration.ExchangeAddress);
            }
            else
            {
                if (!string.IsNullOrEmpty(emailAddress))
                {
                    service = new ExchangeService();
                    service.AutodiscoverUrl(emailAddress);
                }
            }

            return service;
        }
开发者ID:maxpavlov,项目名称:FlexNet,代码行数:26,代码来源:ExchangeHelper.cs

示例2: GetExchangeService

        public static ExchangeService GetExchangeService(string emailAddress, string username, string password, ExchangeVersion exchangeVersion, Uri serviceUri)
        {
            var service = new ExchangeService(exchangeVersion);
            service.Credentials = new WebCredentials(username, password);
            service.EnableScpLookup = false;

            if (serviceUri == null)
            {
                service.AutodiscoverUrl(emailAddress, (url) =>
                {
                    bool result = false;

                    var redirectionUri = new Uri(url);
                    if (redirectionUri.Scheme == "https")
                    {
                        result = true;
                    }

                    return result;
                });
            }
            else
            {
                service.Url = serviceUri;
            }

            return service;
        }
开发者ID:NephelimDK,项目名称:IOfficeConnect,代码行数:28,代码来源:SendEmailJob.cs

示例3: CheckLogin

        /// <summary>
        /// Connects with the Sioux Exchange server to check whether the given username/password are valid
        /// Sioux credentials. Note: this method may take a second or two.
        /// </summary>
        public static bool CheckLogin(string username, string password)
        {
            Console.WriteLine("Connecting to exchange server...");
            ServicePointManager.ServerCertificateValidationCallback = StolenCode.CertificateValidationCallBack;

            var service = new ExchangeService(ExchangeVersion.Exchange2010_SP2);
            service.Credentials = new WebCredentials(username, password, Domain);
            service.Url = new Uri("https://" + ExchangeServer + "/EWS/Exchange.asmx");
            service.UseDefaultCredentials = false;

            try
            {
                // resolve a dummy name to force the client to connect to the server.
                service.ResolveName("garblwefuhsakldjasl;dk");
                return true;
            }
            catch (ServiceRequestException e)
            {
                // if we get a HTTP Unauthorized message, then we know the u/p was wrong.
                if (e.Message.Contains("401"))
                {
                    return false;
                }
                throw;
            }
        }
开发者ID:eteeselink,项目名称:sioux_tech_radar,代码行数:30,代码来源:SiouxExchangeServer.cs

示例4: ConnectToService

        public static ExchangeService ConnectToService(IUserData userData, ITraceListener listener)
        {
            ExchangeService service = new ExchangeService(userData.Version);

            if (listener != null)
            {
                service.TraceListener = listener;
                service.TraceFlags = TraceFlags.All;
                service.TraceEnabled = true;
            }

            service.Credentials = new NetworkCredential(userData.EmailAddress, userData.Password);

            if (userData.AutodiscoverUrl == null)
            {
                Console.Write(string.Format("Using Autodiscover to find EWS URL for {0}. Please wait... ", userData.EmailAddress));

                service.AutodiscoverUrl(userData.EmailAddress, RedirectionUrlValidationCallback);
                userData.AutodiscoverUrl = service.Url;

                Console.WriteLine("Autodiscover Complete");
            }
            else
            {
                service.Url = userData.AutodiscoverUrl;
            }

            return service;
        }
开发者ID:KamilZet,项目名称:zalacznikX,代码行数:29,代码来源:Service.cs

示例5: Bind

 /// <summary>
 /// Binds to an existing task and loads the specified set of properties.
 /// Calling this method results in a call to EWS.
 /// </summary>
 /// <param name="service">The service to use to bind to the task.</param>
 /// <param name="id">The Id of the task to bind to.</param>
 /// <param name="propertySet">The set of properties to load.</param>
 /// <returns>A Task instance representing the task corresponding to the specified Id.</returns>
 public static new Task Bind(
     ExchangeService service,
     ItemId id,
     PropertySet propertySet)
 {
     return service.BindToItem<Task>(id, propertySet);
 }
开发者ID:liliankasem,项目名称:ProjectSpikeAPI,代码行数:15,代码来源:Task.cs

示例6: Bind

 /// <summary>
 /// Binds to an existing calendar folder and loads the specified set of properties.
 /// Calling this method results in a call to EWS.
 /// </summary>
 /// <param name="service">The service to use to bind to the calendar folder.</param>
 /// <param name="id">The Id of the calendar folder to bind to.</param>
 /// <param name="propertySet">The set of properties to load.</param>
 /// <returns>A CalendarFolder instance representing the calendar folder corresponding to the specified Id.</returns>
 public static new CalendarFolder Bind(
     ExchangeService service,
     FolderId id,
     PropertySet propertySet)
 {
     return service.BindToFolder<CalendarFolder>(id, propertySet);
 }
开发者ID:Pravinmprajapati,项目名称:ews-managed-api,代码行数:15,代码来源:CalendarFolder.cs

示例7: ConnectToServiceWithImpersonation

        public static ExchangeService ConnectToServiceWithImpersonation(
            IUserData userData,
            string impersonatedUserSMTPAddress,
            ITraceListener listener)
        {
            ExchangeService service = new ExchangeService(userData.Version);

            if (listener != null)
            {
                service.TraceListener = listener;
                service.TraceFlags = TraceFlags.All;
                service.TraceEnabled = true;
            }

            service.Credentials = new NetworkCredential(userData.EmailAddress, userData.Password);

            ImpersonatedUserId impersonatedUserId =
                new ImpersonatedUserId(ConnectingIdType.SmtpAddress, impersonatedUserSMTPAddress);

            service.ImpersonatedUserId = impersonatedUserId;

            if (userData.AutodiscoverUrl == null)
            {
                service.AutodiscoverUrl(userData.EmailAddress, RedirectionUrlValidationCallback);
                userData.AutodiscoverUrl = service.Url;
            }
            else
            {
                service.Url = userData.AutodiscoverUrl;
            }

            return service;
        }
开发者ID:PavelElis,项目名称:PGRLF.MainWeb,代码行数:33,代码来源:Service.cs

示例8: StreamingSubscriptionCollection

 /// <summary>
 /// Manages the connection for multiple <see cref="StreamingSubscription"/> items. Attention: Use only for subscriptions on the same CAS.
 /// </summary>
 /// <param name="exchangeService">The ExchangeService instance this collection uses to connect to the server.</param>
 public StreamingSubscriptionCollection(ExchangeService exchangeService, Action<SubscriptionNotificationEventCollection> EventProcessor, GroupIdentifier groupIdentifier)
 {
     this._exchangeService = exchangeService;
     this._EventProcessor = EventProcessor;
     this._groupIdentifier = groupIdentifier;
     _connection = CreateConnection();
 }
开发者ID:hoetz,项目名称:StreamO,代码行数:11,代码来源:StreamingSubscriptionCollection.cs

示例9: Bind

 /// <summary>
 /// Binds to an existing meeting cancellation message and loads its first class properties.
 /// Calling this method results in a call to EWS.
 /// </summary>
 /// <param name="service">The service to use to bind to the meeting cancellation message.</param>
 /// <param name="id">The Id of the meeting cancellation message to bind to.</param>
 /// <returns>A MeetingCancellation instance representing the meeting cancellation message corresponding to the specified Id.</returns>
 public static new MeetingCancellation Bind(ExchangeService service, ItemId id)
 {
     return MeetingCancellation.Bind(
         service,
         id,
         PropertySet.FirstClassProperties);
 }
开发者ID:Pravinmprajapati,项目名称:ews-managed-api,代码行数:14,代码来源:MeetingCancellation.cs

示例10: Bind

 /// <summary>
 /// Binds to an existing e-mail message and loads the specified set of properties.
 /// Calling this method results in a call to EWS.
 /// </summary>
 /// <param name="service">The service to use to bind to the e-mail message.</param>
 /// <param name="id">The Id of the e-mail message to bind to.</param>
 /// <param name="propertySet">The set of properties to load.</param>
 /// <returns>An EmailMessage instance representing the e-mail message corresponding to the specified Id.</returns>
 public static new EmailMessage Bind(
     ExchangeService service,
     ItemId id,
     PropertySet propertySet)
 {
     return service.BindToItem<EmailMessage>(id, propertySet);
 }
开发者ID:liliankasem,项目名称:ProjectSpikeAPI,代码行数:15,代码来源:EmailMessage.cs

示例11: Bind

 /// <summary>
 /// Binds to an existing item, whatever its actual type is, and loads the specified set of properties.
 /// Calling this method results in a call to EWS.
 /// </summary>
 /// <param name="service">The service to use to bind to the item.</param>
 /// <param name="id">The Id of the item to bind to.</param>
 /// <param name="propertySet">The set of properties to load.</param>
 /// <returns>An Item instance representing the item corresponding to the specified Id.</returns>
 public static Item Bind(
     ExchangeService service,
     ItemId id,
     PropertySet propertySet)
 {
     return service.BindToItem<Item>(id, propertySet);
 }
开发者ID:Pravinmprajapati,项目名称:ews-managed-api,代码行数:15,代码来源:Item.cs

示例12: GetNextAppointments

        public AppointmentGroup GetNextAppointments()
        {
            try
            {
                var newAppointments = new AppointmentGroup();

                var service = new ExchangeService();
                service.UseDefaultCredentials = true;
                service.AutodiscoverUrl(UserPrincipal.Current.EmailAddress);

                DateTime from = DateTime.Now.AddMinutes(-5);
                DateTime to = DateTime.Today.AddDays(1);

                IEnumerable<Appointment> appointments =
                    service.FindAppointments(WellKnownFolderName.Calendar, new CalendarView(from, to))
                        .Select(MakeAppointment);

                newAppointments.Next =
                    appointments.Where(o => o != null && o.Start >= DateTime.Now)
                        .OrderBy(o => o.Start).ToList();

                nextAppointments = newAppointments;
                return newAppointments;
            }
            catch (Exception e)
            {
                Trace.WriteLine(e.ToString());
                return nextAppointments;
            }
        }
开发者ID:MatthewRichards,项目名称:better-outlook-reminder,代码行数:30,代码来源:OutlookService.cs

示例13: ExchangeWriter

 public ExchangeWriter()
 {
     log.Debug("Creating Exchange writer");
     ExchangeConnection con = new ExchangeConnection();
     service = con.GetExchangeService();
     ResetAppointmentObject();
 }
开发者ID:atosorigin,项目名称:GoogleToExchangeCalendarMigration,代码行数:7,代码来源:ExchangeWriter.cs

示例14: Bind

 /// <summary>
 /// Binds to an existing Persona and loads the specified set of properties.
 /// Calling this method results in a call to EWS.
 /// </summary>
 /// <param name="service">The service to use to bind to the Persona.</param>
 /// <param name="id">The Id of the Persona to bind to.</param>
 /// <param name="propertySet">The set of properties to load.</param>
 /// <returns>A Persona instance representing the Persona corresponding to the specified Id.</returns>
 public static new Persona Bind(
     ExchangeService service,
     ItemId id,
     PropertySet propertySet)
 {
     return service.BindToItem<Persona>(id, propertySet);
 }
开发者ID:Pravinmprajapati,项目名称:ews-managed-api,代码行数:15,代码来源:Persona.cs

示例15: Persona

        /// <summary>
        /// Initializes an unsaved local instance of <see cref="Persona"/>. To bind to an existing Persona, use Persona.Bind() instead.
        /// </summary>
        /// <param name="service">The ExchangeService object to which the Persona will be bound.</param>
        public Persona(ExchangeService service)
            : base(service)
        {
            this.PersonaType = string.Empty;
            this.CreationTime = null;
            this.DisplayNameFirstLastHeader = string.Empty;
            this.DisplayNameLastFirstHeader = string.Empty;
            this.DisplayName = string.Empty;
            this.DisplayNameFirstLast = string.Empty;
            this.DisplayNameLastFirst = string.Empty;
            this.FileAs = string.Empty;
            this.Generation = string.Empty;
            this.DisplayNamePrefix = string.Empty;
            this.GivenName = string.Empty;
            this.Surname = string.Empty;
            this.Title = string.Empty;
            this.CompanyName = string.Empty;
            this.ImAddress = string.Empty;
            this.HomeCity = string.Empty;
            this.WorkCity = string.Empty;
            this.Alias = string.Empty;
            this.RelevanceScore = 0;

            // Remaining properties are initialized when the property definition is created in
            // PersonaSchema.cs.
        }
开发者ID:Pravinmprajapati,项目名称:ews-managed-api,代码行数:30,代码来源:Persona.cs


注:本文中的ExchangeService类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。