【问题标题】:Sharepoint online email integration with Office 365Sharepoint 在线电子邮件与 Office 365 的集成
【发布时间】:2016-04-08 08:23:20
【问题描述】:

我目前正在尝试查找有关如何在 Outlook Web 应用程序中打开存储在 Sharepoint Online 中的电子邮件的选项。这意味着我已经从 Outlook 中拖了一封电子邮件,并拖到了 SharePoint 在线文档库中。但是,我想通过 SP 在线回复电子邮件,只需单击该项目(然后它会在 Outlook Web 应用程序中打开)。

如果这不是开箱即用的,有没有办法为它创建一个应用程序,例如使用 Outlook web api 来实现这个功能?

【问题讨论】:

    标签: c# sharepoint workflow office365


    【解决方案1】:

    当您以 *.msg 文件格式保存电子邮件并将文件上传到 SharePoint Online 时,它​​不会在 Outlook Web App (OWA) 中打开,因为 OWA 不理解 *.msg 文件格式(丰富的文件格式)。您可以下载该文件并使用您的 Outlook 客户端打开。

    如果您想创建一个应用程序来实现这一点。在 c# 中,您可以通过以下步骤使用 SharePoint Client dll:

    1.通过用户名和密码创建的凭据对象向SharePoint发出请求:

     ClientContext context = new ClientContext(SiteUrl);
     context.Credentials = new SharePointOnlineCredentials(UserName, Password);
    

    2.提供文件url从.msg文件中读取数据:

    public Stream GetFile() 
        { 
            using (ClientContext clientContext = GetContextObject()) 
            { 
    
                Web web = clientContext.Web; 
                clientContext.Load(web, website => website.ServerRelativeUrl); 
                clientContext.ExecuteQuery(); 
                Regex regex = new Regex(SiteUrl, RegexOptions.IgnoreCase); 
                string strSiteRelavtiveURL = regex.Replace(FileUrl, string.Empty); 
                string strServerRelativeURL = CombineUrl(web.ServerRelativeUrl, strSiteRelavtiveURL); 
    
                Microsoft.SharePoint.Client.File oFile = web.GetFileByServerRelativeUrl(strServerRelativeURL); 
                clientContext.Load(oFile); 
                ClientResult<Stream> stream = oFile.OpenBinaryStream(); 
                clientContext.ExecuteQuery(); 
                return this.ReadFully(stream.Value); 
            } 
        } 
    

    3。您可以下载带有 FileStream 对象的 .msg 文件(点击here 下载整个演示)。之后,您可以use c# to read information from the file 然后通过 System.Net.Mail.MailMessage 发送电子邮件:

    System.Net.Mail.MailMessage mail = new System.Net.Mail.MailMessage();
    SmtpClient SmtpServer = new SmtpClient("servername"); 
    mail.From = new MailAddress(strFromAddress);
    mail.To.Add(strToAddress);
    mail.Subject = strSubject;
    mail.Body = strMessage;
    SmtpServer.Send(mail);
    

    【讨论】:

    • 非常感谢您的回复。所以你的意思是没有选项可以单击存储在 SharePoint Online 中的项目(.msg 项目)并在 Outlook 365 或 Outlook 2013(客户端)中打开该项目以便从那里回复电子邮件?
    • @Sambas23 AFAIK,是的,不支持直接从 SharePoint Online 打开 MSG 文件,您需要使用支持 MSG 文件格式的客户端(例如 Outlook)下载并打开。
    • 非常感谢南宇的帮助。
    • 但是,为了确保,是否有可能的方法来执行此功能?例如使用 Office 365 web api?
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2022-09-24
    • 2012-11-09
    • 2021-06-11
    相关资源
    最近更新 更多