2008-11-23 118 views
1

我有一些将Outlook电子邮件上载到文档库的客户端代码,只要路径指向文档库的根目录就行了。使用WebClient将文档上载到SharePoint文档库中的特定文件夹

@"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; 
    } 

,但我一直没能走出FIGUR如何上传到同一个文档库中的现有文件夹中,即“电子邮件”。 甚至没有谷歌似乎知道答案:-)

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


我什么时候能学会不给加班到深夜:-(

对不起疑问的。Igalse是正确的,我只是需要“电子邮件/”添加到URL。我可以发誓我已经尝试过了,但后来看起来确实看起来没有。

+0

我犯了和你一样的错误...... Durrrr – 2013-03-08 17:17:37

回答

5

随着你的代码,我刚刚添加/电子邮件/到projectUrl和上传工作得很好。你试过吗?也许你有许可问题

相关问题