0

One of the Projects I am working on I have a requirement to show the SharePoint site name on the Quick Launch, now this should be dynamic in nature so whatever site user is working on, he or she should see the respective site name in the quick launch, since I have a master page applied already, i am thinking about JS/JQ solution to this so that I can put the code in the master page itself and keep the behavior consistent across the all the sites.

Also if possible I would like to show the site name and Library name on the SharePoint library upload form. So let's say when a user performs upload action then he or she should see something similar to below, again this should be dynamic in nature, so I am not looking to add a web part and show text in it. Assuming this would be a JS /JQ code that woudl go into a web part on the SharePoint library edit form.

enter image description here Please help if anyone knows a solution to the above, thanks in advance.

<script type="text/javascript" src="https://code.jquery.com/jquery-1.12.4.js"></script>
<script type="text/javascript">
$(document).ready(function(){
try
{
    $(".ms-dlgTitle").before("<div>Site name: "+_spPageContextInfo.webTitle+"<br/> Library Name: " + _spPageContextInfo.listTitle + "</div>");
}
catch(err)
{}
}); 
</script>
1

This code should do the trick, if you have jQuery included and if you already have the way to include the javascript to the page:

try
{
    $(".ms-dlgTitle").before("<div>Site name: "+_spPageContextInfo.webTitle+"<br/> Library Name: " + _spPageContextInfo.listTitle + "</div>");
}
catch(err)
{}

You can, of course, change the text or add some styling to the message.

  • Hi Damjan, I updated my code in the question based on your input and added it to the Script editor web part on the SharePoint library default edit form. But it did not work, can you please check if anything is wrong in the code? – mdevm Jun 9 '18 at 1:06
  • Hi Damjan, Any updates on this? – mdevm Jun 11 '18 at 15:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.