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


C# Item.Load方法代码示例

本文整理汇总了C#中Item.Load方法的典型用法代码示例。如果您正苦于以下问题:C# Item.Load方法的具体用法?C# Item.Load怎么用?C# Item.Load使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Item的用法示例。


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

示例1: Procesar

        private bool Procesar(Item item)
        {
            bool respuesta = false;
            try
            {
                item.Load();//cargamos el resto del mensaje.
                MessageBody messageBody = item.Body;//obtenemos el Body del mensaje

                //DeleteMode.HardDelete Eliminamos completamente el item.
                //DeleteMode.MoveToDeletedItems Movemos el item a la carpeta de eliminados
                //DeleteMode.SoftDelete Depende de ExchangeVersion, pero principalmente permite la recuperacion del item despues de eliminado.

                if (item.HasAttachments)//si tiene adjuntos
                    ProcesarAdjuntos(item);
                else
                                if (item.Subject.ToLower().Contains("eliminar") || messageBody.Text.ToLower().Contains("eliminar")) // Revisamos si el asunto o en el body contiene la palabra "eliminar"
                {
                    item.Delete(DeleteMode.HardDelete);//Eliminamos completamente el item.
                    respuesta = true;
                    Trace.TraceInformation("Item Eliminado.");
                }
                else if (item.Subject.ToLower().Contains("mover") || messageBody.Text.ToLower().Contains("mover")) // Revisamos si el asunto o en el body contiene la palabra "mover"
                {
                    FolderId folderID = getFolderID("procesados");

                    if (folderID != null)//si encontramos la carpeta la
                    {
                        item.Move(folderID);//movemos el item.
                        respuesta = true;
                        Trace.TraceInformation("Item Movido.");
                    }
                }
                else
                {
                    item.Delete(DeleteMode.MoveToDeletedItems);//lo movemos a la papelera
                    Trace.TraceInformation("Item Movido a carpeta Eliminados");
                }

            }
            catch (Exception)
            {

            }
            return respuesta;
        }
开发者ID:Usiiel,项目名称:csharp-acs-workerrole-ews,代码行数:45,代码来源:ExchangeController.cs

示例2: GetItemMime

        /// <summary>
        /// Get the MIME for the item and return MIME as a string. 
        /// 
        /// </summary>
        /// <param name="item">Item with the MimeContent to get</param>
        /// <param name="service">Exchagne service to use</param>
        /// <param name="TheMime">MIME string to set</param>
        public static void GetItemMime(Item oItem,
            ExchangeService service,
            ref string TheMime)
        {
            DebugLog.WriteVerbose(String.Format("Getting item MIME."));
            string MimeToReturn = string.Empty;
            try
            {
                PropertySet oMimePropertySet = new PropertySet(ItemSchema.MimeContent);
                oItem.Load(oMimePropertySet);

                if (oItem.MimeContent == null)
                    throw new ApplicationException("No MIME content to write");
                else
                    TheMime =  oItem.MimeContent.ToString();

            }
            catch (Exception ex)
            {
                MimeToReturn = "Error getting MIME: \r\n" + ex.Message;
            }
            TheMime = MimeToReturn;

            DebugLog.WriteVerbose(String.Format("Finished item MIME."));
        }
开发者ID:haiyangIt,项目名称:Haiyang,代码行数:32,代码来源:DumpHelper.cs

示例3: DoExportEmlItem

        private void DoExportEmlItem(Item itemInEws, MemoryStream emlStream, EwsServiceArgument argument)
        {
            PropertySet props = new PropertySet(EmailMessageSchema.MimeContent);
            //itemInEws.Load(props);
            //This results in a GetItem call to EWS.
            AutoResetEvent ev = new AutoResetEvent(false);
            Exception ex = null;
            Timer t = null;
            try
            {
                bool hasLoad = false;
                t = new Timer((arg) =>
                {
                    try
                    {
                        if (hasLoad)
                        {
                            ex = new TimeoutException("Export eml message time out.");
                            ev.Set();
                        }
                        else
                        {
                            hasLoad = true;
                            itemInEws.Load(props);
                            ev.Set();
                        }
                    }
                    catch (Exception e)
                    {
                        ex = e;
                        LogFactory.LogInstance.WriteException(LogLevel.ERR, "Export eml failed", e, e.Message);
                        ev.Set();
                    }
                }, null, 0, ExportUploadHelper.TimeOut);
                while (!ev.WaitOne(1000))
                {

                }
            }
            finally
            {
                if (t != null)
                    t.Dispose();
                if (ev != null)
                    ev.Dispose();
                t = null;
                ev = null;
            }

            if (ex != null)
            {
                throw new ApplicationException("Export eml error", ex);
            }

            //var email = EmailMessage.Bind(CurrentExchangeService, itemInEws.Id, props);
            emlStream.Write(itemInEws.MimeContent.Content, 0, itemInEws.MimeContent.Content.Length);
            itemInEws.MimeContent.Content = null;
        }
开发者ID:haiyangIt,项目名称:Haiyang,代码行数:58,代码来源:ItemOperatorImpl.cs


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