• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# ExchangeService类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: SubscriptionBase

        /// <summary>
        /// Initializes a new instance of the <see cref="SubscriptionBase"/> class.
        /// </summary>
        /// <param name="service">The service.</param>
        /// <param name="id">The id.</param>
        internal SubscriptionBase(ExchangeService service, string id)
            : this(service)
        {
            EwsUtilities.ValidateParam(id, "id");

            this.id = id;
        }
开发者ID:liliankasem,项目名称:ProjectSpikeAPI,代码行数:12,代码来源:SubscriptionBase.cs


示例17: GetWellKnownFolder

        /// <summary>
        /// Method is returning Folder object from WellKnownFolderName enum.
        /// </summary>
        /// <param name="wellKnownFolderName">WellKnownFolderName for which Folder object needs to be returned.</param>
        /// <param name="ewsSession">ExchangeService session context.</param>
        /// <returns></returns>
        public static Folder GetWellKnownFolder(WellKnownFolderName wellKnownFolderName, ExchangeService ewsSession)
        {
            FolderId wellKnownFolderId = new FolderId(wellKnownFolderName);
            Folder wellKnownFolder = Folder.Bind(ewsSession, wellKnownFolderId);

            return wellKnownFolder;
        }
开发者ID:IvanFranjic,项目名称:XEws,代码行数:13,代码来源:XEwsFolderCmdlet.cs


示例18: Bind

 /// <summary>
 /// Binds to an existing appointment 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 appointment.</param>
 /// <param name="id">The Id of the appointment to bind to.</param>
 /// <param name="propertySet">The set of properties to load.</param>
 /// <returns>An Appointment instance representing the appointment corresponding to the specified Id.</returns>
 public static new Appointment Bind(
     ExchangeService service,
     ItemId id,
     PropertySet propertySet)
 {
     return service.BindToItem<Appointment>(id, propertySet);
 }
开发者ID:liliankasem,项目名称:ProjectSpikeAPI,代码行数:15,代码来源:Appointment.cs


示例19: 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)
            {
                service.AutodiscoverUrl(userData.EmailAddress, RedirectionUrlValidationCallback);
                userData.AutodiscoverUrl = service.Url;
            }
            else
            {
                service.Url = userData.AutodiscoverUrl;
            }

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


示例20: Bind

 /// <summary>
 /// Binds to an existing contact 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 contact.</param>
 /// <param name="id">The Id of the contact to bind to.</param>
 /// <param name="propertySet">The set of properties to load.</param>
 /// <returns>A Contact instance representing the contact corresponding to the specified Id.</returns>
 public static new Contact Bind(
     ExchangeService service,
     ItemId id,
     PropertySet propertySet)
 {
     return service.BindToItem<Contact>(id, propertySet);
 }
开发者ID:Pravinmprajapati,项目名称:ews-managed-api,代码行数:15,代码来源:Contact.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# ExcludeIncludeFieldsList类代码示例发布时间:2022-05-24
下一篇:
C# Exchange类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap