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


C# Microsoft.Office.Interop.Outlook.Copy方法代码示例

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


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

示例1: ArchiveSelectedItem

        public static bool ArchiveSelectedItem(bool treatAtSentMail, BrugerInfo currentBruger, Outlook.MailItem mailItem, MailItemInfo mailItemInfo, KundeInfo companyInfo, KontaktInfo contactInfo, TaskInfo taskInfo, Outlook.NameSpace sessionNamespace)
        {
            var fromBruger = treatAtSentMail ? currentBruger : null;
            var toBruger = treatAtSentMail ? currentBruger : null;
            var documentType = treatAtSentMail ? DocumentType.SentMail : DocumentType.ReceivedMail;
            var documentGuid = Guid.NewGuid();

            var companyFolder = TryGetCompanyOutlookFolder(companyInfo.ID, currentBruger, sessionNamespace);

            // Vi har muligvis ikke rettigheder til at tilgå eller oprette mappen
            // Brugeren har fået besked så vi kan returnere
            if (companyFolder == null)
            {
                return false;
            }

            SetIOfficeProperties(documentGuid, mailItem);

            dynamic archivedItemDynamic;

            var itemCopy = (Outlook.MailItem)mailItem.Copy();

            archivedItemDynamic = itemCopy.Move(companyFolder);

            var archivedItem = (Outlook.MailItem)archivedItemDynamic;

            // Efter move får item nyt entryID og storeID
            mailItemInfo = new MailItemInfo(archivedItem);

            var mailItemDocument = new IOfficeOutlookAddIn.Document()
            {
                DOC_Body = mailItemInfo.BodyPlainText,
                DOC_CompanyGUID = companyInfo.ID,
                DOC_ContactGUID = contactInfo != null ? contactInfo.ID : new Nullable<Guid>(),
                DOC_CreatedByGUID = currentBruger.ID,
                DOC_CreatedDate = DateTime.Now,
                DOC_DocumentType = (int)documentType,
                DOC_ExchangeEntryID = mailItemInfo.CurrentMailItemEntryID,
                DOC_ExchangeFolderEntryID = null, // BRUGES IKKE
                DOC_ExchangeFolderStoreID = null, // BRUGES IKKE
                DOC_ExchangeStoreID = mailItemInfo.CurrentMailItemFolderStoreID,
                DOC_FromUserGUID = fromBruger != null ? fromBruger.ID : new Nullable<Guid>(),
                DOC_GUID = documentGuid,
                DOC_IsArchived = 1,
                DOC_IsInstantiated = 1,
                DOC_IsPrivate = 0,
                DOC_MailCreatedDatetime = mailItemInfo.Created,
                DOC_MailReceivedDatetime = mailItemInfo.Received,
                DOC_MailSentDatetime = mailItemInfo.Sent,
                DOC_MailUpdatedDatetime = DateTime.Now, // Hvad er det?
                DOC_MasterDate = DateTime.Now, // Hvad er det?
                DOC_OriginalFileName = string.Empty,
                DOC_ProjectGUID = null,
                DOC_SMTP_From = mailItemInfo.FromEmailAddress,
                DOC_SMTP_FromDisplayName = string.IsNullOrEmpty(mailItemInfo.FromDisplayName) == false ? mailItemInfo.FromDisplayName : treatAtSentMail == true ? fromBruger.Navn : "(Unknown)",
                DOC_SMTP_To = mailItemInfo.RecipientsEmailAddress,
                DOC_SMTP_ToDisplayName = mailItemInfo.RecipientsDisplayName,
                DOC_Subject = mailItemInfo.Subject,
                DOC_TaskGUID = taskInfo != null ? taskInfo.ID : new Nullable<Guid>(),
                DOC_TemplateGUID = null,
                DOC_Title = null, // Bruges vist ikke hvis mail
                DOC_ToUserGUID = toBruger != null ? toBruger.ID : new Nullable<Guid>(),
                DOC_TypeGUID = new Nullable<Guid>(), // BRUGES IKKE
                DOC_UpdatedByGUID = currentBruger.ID,
                DOC_UpdatedDate = DateTime.Now,
                DOC_WebVisible = 0,
                IsThrash = 0
            };

            using (var _dc = new iorunEntities())
            {
                _dc.Document.Add(mailItemDocument);

                _dc.SaveChanges();
            }

            return true;
        }
开发者ID:NephelimDK,项目名称:IOfficeConnect,代码行数:78,代码来源:IOfficeConnectGlobals+(TERMINAL01s+modstridende+kopi+2015-05-07).cs


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