我有一些客户端代码可以将Outlook电子邮件上传到文档库,只要路径指向文档库的根目录就可以了。

@"https://<server>/sites/<subweb>/<customer>/<teamweb>/<Documents>/" + docname;

是此函数中的projectUrl:

public bool SaveMail(string filepath, string projectUrl)
    {
        try
        {
            using (WebClient webclient = new WebClient())
            {
                webclient.UseDefaultCredentials = true;
                webclient.UploadFile(projectUrl, "PUT", filepath);
            }
        }
        catch(Exception ex)
        {
            //TO DO Write the exception to the log file
            return false;
        }
        return true;
    }

但我无法弄清楚如何上传到现有文件夹,即<!>“;电子邮件<!>”;在同一个文档库中。 谷歌似乎也不知道答案: - )

注意:我知道我可以使用SharePoint中的复制Web服务将文件移动到最终目标,但这更像是一种解决方法。


我什么时候才能学会不在深夜工作: - (

对此问题感到抱歉。 Igalse是对的,我只需要添加<!> quot; emails / <!> quot;到URL。我可以发誓我已经尝试过了,但是再一次确实看起来我没有尝试过。

有帮助吗?

解决方案

使用您的代码我只是将/ Emails /添加到projectUrl并且上传工作正常。你试过吗?也许你有许可问题。

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top