The HTTP request is unauthorized with client authentication scheme ‘Ntlm’ The authentication header received from the server was ‘NTLM’

Visual Studio 2005 Create a new console application project in Visual Studio Add a “Web Reference” to the Lists.asmx web service. Your URL will probably look like: http://servername/sites/SiteCollection/SubSite/_vti_bin/Lists.asmx I named my web reference: ListsWebService Write the code in program.cs (I have an Issues list here) Here is the code. using System; using System.Collections.Generic; using System.Text; … Read more

Upload file to SharePoint drive using Microsoft Graph

In order to get all the files of a drive using v1.0, you would first need to get an access token, then get the ‘drive-id’ and use the following URL (note: it is ‘drives’ not ‘drive’): https://graph.microsoft.com/v1.0/drives/{drive-id}/root/children To get the drive id, make the following GET request using postman, this will list all the drives … Read more

How to check if a word starts with a given character?

To check one value, use: string word = “Aword”; if (word.StartsWith(“A”)) { // do something } You can make a little extension method to pass a list with A, B, and C public static bool StartsWithAny(this string source, IEnumerable<string> strings) { foreach (var valueToCheck in strings) { if (source.StartsWith(valueToCheck)) { return true; } } return … Read more

What does square bracket [] mean in the below code?

As @Spencer Ruport said, they’re attributes. They’re used within .NET for declarative programming. You can find information on each of these attributes at MSDN. However, you should know that the name of the attribute can be shortened. In your case, for example, Category is the short form of the class name CategoryAttribute and XmlElement is … Read more

How to read SharePoint Online (Office365) Excel files in Python with Work or School Account?

As suggested by Niels V try using the Office365-REST-Python-Client. The client implements the Sharepoint REST API. Here’s an example of what you are trying to do: from office365.runtime.auth.authentication_context import AuthenticationContext from office365.sharepoint.client_context import ClientContext from office365.sharepoint.files.file import File url=”https://yoursharepointsite.com/sites/documentsite” username=”yourusername” password = ‘yourpassword’ relative_url=”/sites/documentsite/Documents/filename.xlsx” This section is straight from the github README.md using the ClientContext … Read more

Python – Download files from SharePoint site

Have you tried Office365-REST-Python-Client library, it supports SharePoint Online authentication and allows to download/upload a file as demonstrated below: Download a file from office365.runtime.auth.authentication_context import AuthenticationContext from office365.sharepoint.client_context import ClientContext from office365.sharepoint.files.file import File ctx_auth = AuthenticationContext(url) ctx_auth.acquire_token_for_user(username, password) ctx = ClientContext(url, ctx_auth) response = File.open_binary(ctx, “/Shared Documents/User Guide.docx”) with open(“./User Guide.docx”, “wb”) as local_file: … Read more

Open an Excel file from SharePoint site

Try this code to pick a file from a SharePoint site: Dim SummaryWB As Workbook Dim vrtSelectedItem As Variant With Application.FileDialog(msoFileDialogOpen) .InitialFileName = “https://sharepoint.com/team/folder” & “\” .AllowMultiSelect = False .Show For Each vrtSelectedItem In .SelectedItems Set SummaryWB = Workbooks.Open(vrtSelectedItem) Next End With If SummaryWB Is Nothing then Exit Sub If I remember correctly, the Microsoft … Read more

Upload a file to SharePoint through the built-in web services

Example of using the WSS “Copy” Web service to upload a document to a library… public static void UploadFile2007(string destinationUrl, byte[] fileData) { // List of desination Urls, Just one in this example. string[] destinationUrls = { Uri.EscapeUriString(destinationUrl) }; // Empty Field Information. This can be populated but not for this example. SharePoint2007CopyService.FieldInformation information = … Read more

How do you upload a file to a document library in sharepoint?

You can upload documents to SharePoint libraries using the Object Model or SharePoint Webservices. Upload using Object Model: String fileToUpload = @”C:\YourFile.txt”; String sharePointSite = “http://yoursite.com/sites/Research/”; String documentLibraryName = “Shared Documents”; using (SPSite oSite = new SPSite(sharePointSite)) { using (SPWeb oWeb = oSite.OpenWeb()) { if (!System.IO.File.Exists(fileToUpload)) throw new FileNotFoundException(“File not found.”, fileToUpload); SPFolder myLibrary = … Read more

tech