Quantcast
Channel: SharePointCommunity
Viewing all articles
Browse latest Browse all 6649

Datei-Download von Sharepoint

$
0
0

Hallo,

ich möchte aus einer bestehenden MS-Sharepoint-Website eine Datei (.xlsm) downloaden. Wenn ich mich über mein Microsoftkonto anmelde klappt das von Hand auch.

Per HTTP-Request funktioniert es allerdings nicht. Hier mein Code:

Dim wc As WebClient = New WebClient()
        wc.UseDefaultCredentials = False
        Dim url AsString = "https://my.sharepoint.com/myExcel.xlsm"
        Dim creds As CredentialCache = New CredentialCache()
        creds.Add(New Uri(url), "Basic", New NetworkCredential("myUser", _
          "myPassword", "myDomain"))
 
        wc.Credentials = creds
        wc.Headers.Add(HttpRequestHeader.UserAgent, "Mozilla/4.0 (compatible;"& _
          "MSIE 6.0; Windows NT 5.2; .NET CLR 1.0.3705;")
        wc.Headers.Add(HttpRequestHeader.Accept, "application/x-ms-application,"& _
        "image/jpeg, application/xlsm, image/gif, image/pjpeg,"& _
        "application/x-ms-xbap, application/x-shockwave-flash,"& _
        "application/vnd.ms-excel, application/vnd.ms-powerpoint,"& _
        "application/msword, */*")
 
 
        wc.DownloadFile(url, "c:\myExcel.xlsm")

Die Datei wird zwar angelegt, aber nicht die gewünschte Exceldatei sondern ein Script:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> usw.

Bei den Credentials habe ich die Daten von meinem Microsoftkonto eingetragen.

Kann mir da jemand auf die Sprünge helfen? Oder gibt es eine Möglichkeit z. B. über eine Batch-Datei einen automatischen Download aus SharePoint anzustoßen?


Viewing all articles
Browse latest Browse all 6649


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>