Sharepoint 2013: List name does not correspond to URL name

It can be quite frustrating when the name of a list does not correspond to the URL. 

For example, the default Images library maps to /publishingimages/. 

I had this problem a little while ago and the solution was staring me in the face - the answer is held in the object model. If you pass in the name of the list ("Images"), you can get the SPList the old fashioned way: 

SPList list = SPContext.Current.Web.Lists["Images"].

However, if you manufacture a link, you need to use list.RootFolder.Name (or SPContext.Current.Web.Lists["Images"].RootFolder.Name)

Comments

Popular posts from this blog

SharePoint 2013: Error updating managed account credentials

Error deploying Nintex workflow: An item with the same key has already been added