SharePoint is a web-based collaborative platform that integrates with Microsoft Office. It was launched in 2001 and is primarily used as a document management and storage system, but the product is highly configurable and usage varies substantially among organizations.
Organizations use Microsoft SharePoint to create websites. You can use it as a secure place to store, organize, share, and access information from any device. All you need is a web browser, such as Microsoft Edge, Internet Explorer, Chrome, or Firefox.
Sign in to SharePoint
- Sign in to your work or school account at office.com/signin.
- Select the SharePoint tile on the on the Microsoft 365 home page, or in the app launcher.
The crux is automatic operations on Sharepoint as the title suggests performing CRUD on sharepoint as follows
- Auto Upload of documents on sharepoint
- Auto Download of documents from sharepoint
- Auto creation of folder structure on sharepoint
- Auto deletion of files or folders from sharepoint and so on.
More details are as follows –
SharePoint facilitates transfer of files from local machine to Share Point server and vice versa. This feature is widely used in organizations by users. Currently this process is taking huge amount of time and executives, engineers other users get frustrated with this activity leading to lesser productivity and negative efficiency (I call it nefficiency). How to manage sharepoint to do all upload/download etc a bit faster. Here is the solution at Tobo’s Point.
Idea to use Sharepoint APIs thus eliminating manual effort and make CRUD a click away.
Massive time consumption in uploading/downloading files through different paths. Users waste several hours struggling with share point GUI over transfer of files to and fro (Local Machine to Share Point server & Vice versa)
Folders creation/Deletion/Edit with respect to data variation. Users struggle with CRUD(Create, Read, Update, Delete) operations of folders/subfolders etc.
Several hours are wasted on daily basis.
Providing a solution to Automate all of the above. To drive efficiency through automation of Share Point using its APIs at the back end and give power to Users to upload, download, create files folders etc in just a click. Size matters no more.
Lets take a simple example , Current Scenario – One file upload takes 7-8 minutes. Using the Share Point API it will take 5 seconds. Time saved in one file 4 minutes 55 seconds.
Total files uploaded by an user on an average = 50. Total time consumed = 250 minutes.
Using Share Point API = Time = 5 seconds * 50 files = 250 seconds = 5 minutes.
Total Time saved =~~ 245 minutes.
This Is Huge. A Major Break Through
Code will be uploaded shortly. It is a JAVA code with complete API help.
Step by step guide is below.
The sharepoint URL for the organization is below.
In the link above the organization is “gotobo”. The name of the site is “Test”. Default folder is “Shared Documents” which is common for all the organizations. Now first we need to make this site trustworthy. In order to do that we need to generate client ID and secret ID of the site using the below links. Remember the site name “Test” from the URL above is crucial in order to create credentials.
Now to perform CRUD operations follow the below steps
Step 1 – Create your own link as follows –
Above link is for my organization’s sharepoint. In your case you need to change the organization(gotobo) and sitename(Test) as highlighted above in bold italics.
Following page will appear. Click on Generate as shown below, Client ID and Client secret will get generated. Then under Title put your site name. Here we are taking our example so putting “Test”. Under App Domain put localhost, Under Redirect URL put https://localhost. Refer snapshot below.
Once you have clicked on the two generate buttons above you will see something like this.
Client ID and Client Secret has been generated as shown above against red arrows. Now click on the create button to navigate onto another page as shown below.
Remember to click on the OK button before you exit this page. Once you click OK the client ID and Secret ID will be registered and can be used in your codes (Java or Python) for CRUD operations. Do copy the client ID and Secret ID because if you forget to do so you will have to create new credentials again for further use. Copy them and keep them for further actions like in the blog below.
Once you have the credentials and by credentials i mean client ID and Client Secret ID, we will move to another link to get the IDs trsuted. So create another link as follows.
So again as you can see we have highlighted the organization (gotobo) and site name (Test) for you to change in accordance with your organization name and site name. Once you have created the link as above go to that link and you will see a window as follows.
In the above picture you can see App ID marked as (1) in red and Look up marked as (2) in red. Enter your client ID which you had copied earlier in (1) and click (2). Complete information of your site will appear as follows.
So as shown above by red arrows the information is auto populated in the fields once the look up button is pressed. Now we need to enter some information in the block (3) as shown in red. Enter following XML snippet into it and click on create button.
<AppPermissionRequest Scope=”http://sharepoint/content/sitecollection/web” Right=”FullControl”/>
Copy above three lines and paste in the block as shown below marked (4) in red.
Once entered the xml snippet click on create button and you will be redirected to ‘Trust it’ page where click on the ‘Trust it’ button as shown below.
Once trusted your 50% part is done. Now you are ready for performing CRUD operations on share point using either JAVA or python. Remember to keep client credentials (Client ID and Client Secret ID with you, save it in a sitck key or notepad++).
Below are seperate links for Share point upload and download code in JAVA. Complete code with proper explanation is given.
15 thoughts on “Sharepoint APIs to upload and download files.”
When will you upload the code? Watching this space for long.
Can you please provide code for upload and download ? Sharepoint APIs as well.
Keep watching the space, we will provide the code shortly.
I’m getting 403 when I try to download
This is an authorization error, Can you please provide your code so that i can troubleshoot it.
Great post. I was checking continuously this blog and I am impressed!
Extremely helpful information specifically the last part 🙂
I care for such information much. I was seeking this certain info for a long time.
Thank you and best of luck.
Thank you, I have recently been looking for info about this topic for a long
time and yours is the best I have came upon so far.
But, what about the conclusion? Are you positive about the source?
This design is spectacular! You certainly know how to keep a reader amused.
Between your wit and your videos, I was almost moved to start my own blog (well, almost…HaHa!) Fantastic job.
I really enjoyed what you had to say, and more than that, how you
presented it. Too cool!
Sweet blog! I found it while searching on Yahoo News. Do you have any suggestions on how to get listed in Yahoo News?
I’ve been trying for a while but I never seem to get
there! Appreciate it