cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
JimmyWork
Level 8

Possible to add a document library to navigation menu using flow?

Hi

 

Im trying to solve the issue i have. My flow creates a Document Library using "Send an HTTP request to SharePoint"

I would like for the flow to add it to the navigation menu also, so if a new Document Library is created it should be displayed in the mnu/navigation on the site also.

 

  • Flow triggers from create an item
  • Document Library is created based in items Title
  • Document Library should be added to navigation on the site it was created on.

The last part i dont know how to achive

4 REPLIES 4
dvdalen
Level: Powered On

Re: Possible to add a document library to navigation menu using flow?

Here is an old article about adding items to the navigation using REST API: https://rmanimaran.wordpress.com/2014/11/12/sharepoint-2013-working-on-navigation-using-rest-api/

Super User
Super User

Re: Possible to add a document library to navigation menu using flow?

Updating the navigation isn't something you'd be able to do using the default functionality of the SharePoint Online connector as it isn't included with the connector's actions.

However, this is likely something you may be able to do using JavaScript, and while Flow does not currently have JavaScript trigger support this is something you may be able to accomplish with Azure Functions.

MVP Julie Turner has a great blog post, SharePoint + Flow (+ Azure Functions): Launching a Microsoft Flow from Client-Side Code, that outlines how to call Azure Functions from your Flows

The actual JavaScript for the function could look something like this: 

<UrlAction Url="Javascript&colon;window.location='{SiteUrl}/_layouts/CustomListAction.aspx?ID={ListId}'"/>

Or:

<UrlAction Url="~site/_layouts/Page.aspx?ID={ListId}"/>

And depending on your C# programming level, you may be able to utilize the SPUserCustomActionCollection class to update the SPWeb object. I'm a C# novice, but I beleive the code could look something like this:

using (SPSite site = new SPSite("http://newsite.sharepoint.com"))
        using (SPWeb web = site.OpenWeb())
        {
            SPContentType contentType = web.ContentTypes["Curriculum Vitae"];

            SPUserCustomAction action = web.UserCustomActions.Add();
            action.RegistrationType = SPUserCustomActionRegistrationType.ContentType;
            action.RegistrationId = contentType.Id.ToString();
            action.Location = "EditControlBlock";
            action.Sequence = 450;
            action.Title = "Test";
            action.Rights = SPBasePermissions.EditListItems;
            action.Url = "http://newsite.sharepoint.com";

            action.Update();
        }

If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up. THANKS!

JimmyWork
Level 8

Re: Possible to add a document library to navigation menu using flow?

Thank you for the replay.

This might work, but  im pretty new to rest api and Jquery.

 

I would use a "Trigger an event based on select REST API" and in the body i will call the Jquery?

 

 
JimmyWork
Level 8

Re: Possible to add a document library to navigation menu using flow?

My programing skills is 0.

I understand code but i cannot write it very well.

 

I would like to call this using Rest API, i belive it is possible but again might be limitation, but according to the answer from @dvdalen this seems possible

Helpful resources

Announcements
thirdimage

Power Automate Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

firstImage

Incoming: New and improved badges!

We've given our badges an overhaul and also added some brand new ones!

fifthimage

Microsoft Learn

Learn how to build the business apps that you need.

sixthImage

Power Platform World Tour

Find out where you can attend!

seventhimage

Webinars & Video Gallery

Watch & learn from the Power Automate Community Video Gallery!

Top Kudoed Authors (Last 30 Days)
Users online (4,856)