How to add a document library link to the quickLaunch navigation in sharepoint programatically?

Tapiwanashe Ndhlovu 20 Reputation points
2023-06-04T19:53:24.15+00:00

I'm using microsoft graph to create a site collection and it's document libraries programatically using c# and microsoft graph api with azure functions. I want to be able to add a document library link to the quickLaunch navigation once it has been created. I tried using microsoft graph api but it seems like there is no endpoint yet for modifying the quickLaunch navigation.

Now I want to try pnp framework to modify the quickLaunch, is there any way I can use pnp framework concurrently with microsoft graph and using the same daemon authentication I'm using with microsoft graph. I have tried quite a lot of articles online, can you please point me to any recent articles that can assist.

Microsoft 365 and Office | SharePoint | For business | Windows
Microsoft Security | Microsoft Graph
{count} votes

Accepted answer
  1. Anonymous
    2023-06-05T07:20:16.4233333+00:00

    Hi @Tapiwanashe Ndhlovu,

    In the Microsoft Graph API, there is no direct way to create quick launch navigation links in SharePoint. Microsoft Graph API is mainly used to access and manage resources on the Microsoft 365 platform, including users, groups, mail, calendars, files, etc.

    To create quick launch navigation links in SharePoint, you can use the SharePoint REST API. The SharePoint REST API provides a rich set of endpoints and operations to interact with SharePoint sites and create, update, delete, and more.

    Here are the basic steps to create a quick launch navigation link in SharePoint using the SharePoint REST API:

    Get the web URL of the website: You can use the Microsoft Graph API or the SharePoint REST API to get the URL of the website.

    Construct the request URL: According to the documentation of the SharePoint REST API, construct the appropriate request URL. For example, the following URLs can be used to create quick launch navigation links:

    POST /sites/{site-id}/navigation/quicklaunch

    Build request headers: Set appropriate request headers, such as authentication headers, as needed.

    Build the request body: In the request body, specify the properties of the quick launch navigation link you want to create, such as link title, URL, target, etc.

    Send Request: Send a request using an appropriate method such as POST to create a quick launch navigation link.User's image

    User's image

    Here is link for your reference:

    Rest API :https://www.codesharepoint.com/rest-api/create-quick-launch-link-in-sharepoint-using-rest-api

    At present, the Graph api has not launched a corresponding api, but Microsoft is currently integrating the api in the platform. I think there should be a corresponding api for you to use in the near future。

    https://stackoverflow.com/questions/53766605/microsoft-graph-api-document-library-creation-with-navigation-link

    At present, it is possible to call the Graph API in Power shell to create a document library, and then implement quickLaunch through scripts.

    User's image

    How To Connect To Microsoft Graph API Using PowerShell:https://thesysadminchannel.com/how-to-connect-to-microsoft-graph-api-using-powershell/#:~:text=Connect%20to%20Microsoft%20Graph%20API%20Using%20Interactive%20Logon,pops%20up%204%20You%20should%20see%20authentication%20complete

    quickLaunch:https://www.codesharepoint.com/powershell/create-quick-launch-link-in-sharepoint-using-powershell


    If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    Best Regards

    Cheng Feng

    6 people found this answer helpful.
    0 comments No comments

2 additional answers

Sort by: Most helpful
  1. Marina Reda Abdou Soliman 10 Reputation points
    2023-06-05T02:17:29.9533333+00:00
    1. Navigate to SharePoint Online Document Library.
    2. Click on Settings >> Document Library Settings.
    3. Click on the “List name, description and navigation” link under “General Settings”.
    4. Set “Yes” for “Display this document library on the Quick Launch?”.
    5. Click on the “Save” button.

    This adds the document library to the Quick launch menu. Alternatively, you can click on the “Edit” link under Quick launch navigation and click on the “+” symbol to add a list or document library to the navigation.

    2 people found this answer helpful.

  2. Olfat Sadeek Aldeghidy 1 Reputation point
    2023-06-04T20:06:54.6933333+00:00

    Navigate to SharePoint Online Document Library.

    Click on Settings >> Document Library Settings.

    Click on the “List name, description and navigation” link under “General Settings”.

    Set “Yes” for “Display this document library on the Quick Launch?”.

    #Read more:https://www.sharepointdiary.com/2021/06/how-to-add-document-library-to-site-navigation-in-sharepoint-online.html#ixzz83hLV2PPD


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.