Posts

Showing posts with the label Cloud

In C# CSOM How to Delete Folders Recursively, Sub-Folders, Files in SharePoint Online Document Library

Image
In this article we will see how to delete Root folder, sub-folders, files in SharePoint Document Library.  Here I have given snippet by hardcoding (not recommended) one folder name "TestFolder1".  However you can use loop statement and iterate list of root folder names.  var clientContext = GetClientContextWithAccessToken(siteUrl, accessToken); Web web = clientContext.Web; clientContext.Load(web); clientContext.ExecuteQuery(); //Here you can add for loop with list of root folder names and iterate //Start of for loop string folderPath = "/sites/contoso5/LibraryName/ TestFolder1 "; //Pass the folder name dynamically Folder folder = clientContext.Web.GetFolderByServerRelativeUrl(folderPath); clientContext.Load(folder, folderitem => folderitem.Properties, folderitem => folderitem.Name, folderitem => folderitem.Files); clientContext.ExecuteQuery(); DeleteFolderRecursive(folder); //Call method to delete subfolders and files. folder.DeleteObject(); clientContext.E...

C# How to Get SharePoint Online Documents Analytics Using Graph API

Image
In this article we will see How to get SharePoint Online documents analytics using the Microsoft Graph API. To get, you will need to: Register an app in Azure AD to authenticate and authorize API requests. Grant the app the necessary permissions to read the documents and their analytics data. Use the API to get the analytics data for the documents. Below is the example of how you can do this in C#: using Microsoft.Identity.Client; using Microsoft.Graph; using System.Net.Http.Headers; // Replace these with your own values. const string clientId = "your-client-id"; const string clientSecret = "your-client-secret"; const string tenantId = "your-tenant-id"; const string resourceId = "https://graph.microsoft.com"; const string siteId = "your-site-id"; // Acquire an access token. var authContext = new AuthenticationContext("https://login.microsoftonline.com/" + tenantId); var clientCredential = new ClientCredential(clientId, clientS...

C# How to Access SharePoint Online Lists using Graph API using MSAL

Image
In this article, we will see how to invoke SharePoint Online Lists using Graph API using MSAL authentication in C#. To access a SharePoint Online list using the Microsoft Graph API with MSAL (Microsoft Authentication Library) authentication in C#, you will need to follow these steps: Register your application with Azure Active Directory (AAD) and grant it the necessary permissions to access SharePoint Online. This will enable your application to authenticate with AAD and obtain access tokens. Install the Microsoft.Identity.Client NuGet package in your C# application. This will allow you to authenticate users and obtain access tokens using the MSAL library. Use the MSAL library to authenticate the user and obtain an access token. This token will be used to authorize your application to access SharePoint Online. Use the access token to make a request to the Microsoft Graph API to retrieve the data from the SharePoint Online list. Here is an example of how you can use the MSAL library to ...

C# Http Method How to Upload Document into SharePoint Online Document Library

Image
In this article we will see how to upload file into SharePoint Online Document Library using REST API and HTTP method. Also you will drr how to get the document ID of the same upload document. Here is the code:             string filePath = @"C:\MyFile.pdf";             string siteUrl = "https://domainname.sharepoint.com/sites/contoso5/"             byte[] bytefile = System.IO.File.ReadAllBytes(filePath);             HttpWebRequest endpointReq = (HttpWebRequest)HttpWebRequest.Create(siteUrl + "/_api/web/GetFolderByServerRelativeUrl('DocLib/MyFolder')/Files/add(url='Myfile.pdf',overwrite=true)?$expand=ListItemAllFields");             endpointReq.Method = "POST";             endpointReq.Headers.Add("binaryStringRequestBody", "true");             endpointReq.Headers.Add("Authorizatio...

C# CSOM How to Upload Document into SharePoint Online Document Library

Image
In this article we will see how to upload document into SharePoint Online Document Library using SharePoint Client Object Model CSOM. Also I have given piece of code to get document ID of the  uploaded document. Here is the code:             string siteUrl = "https://domainname.sharepoint.com/sites/contoso5/";             string docUrl = "https://domainname.sharepoint.com/sites/contoso5/DocLib/MyFolder/NewPDF.pdf";             string pathToFile = @"C:\NewPDF.pdf";             var clientContext = GetClientContext(siteUrl);             Web web = clientContext.Web;             clientContext.Load(web, a => a.ServerRelativeUrl);             clientContext.ExecuteQuery();             List documentsList = clientContext.Web.Lists.GetByTitle("DocLib"); ...

SharePoint Online List Item "Copy field to clipboard" option

Image
There is a new option available in SharePoint online "Copy field to clipboard". It is available on list items. On clicking copy field to clipboard from the menu, it copies the content of the field (or near left field of the cursor) will be copied to the clipboard and you can paste it anywhere on text docs. Happy PC (Programming / Configuring)

What is Cloud Computing?

Image
Cloud computing is the delivery of computing services such as servers, database, storage, software, infrastructure, networking, platform through Internet, instead of on your own physical setup at office or home.  Could computing is faster, dynamic resources, ability to quickly increase or decrease the size or power, auto scaling. Simply it is on-demand delivery of IT resources through the internet. Microsoft Cloud Computing refers to a range of services provided by Microsoft that allows users to store, manage, and process data using Microsoft's network of servers. These services are delivered over the internet and are typically accessed via a web browser or a mobile app. Some of the most popular Microsoft Cloud Computing services include: Azure : A cloud computing platform that provides a wide range of services including virtual machines, storage, databases, and networking. Office 365 : A suite of productivity and collaboration tools that includes email, calendar, and online versio...