Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

When creating a new List or Library in SharePoint, or even creating a new Folder inside the list or library, the URL generated by SharePoint may not match the name entered by the user.

I need to programmatically construct the same URL as SharePoint from the same data a user might manually copy and paste into the Create dialog's textboxes, but I don't know the algorithm it uses.

I'm using K2 Studio to create workflows that integrate with SharePoint 2010. Management strongly prefers a no-code solution, but I do have access to Visual Studio and am willing to use it. With the hassles of connecting to a claims-authentication environment, I'd prefer any .Net code use K2's built-in features or not connect to SharePoint.

Edit

Example of problem:

Incoming data which a K2 Blackpearl workflow uses to create a new library: abc-123 (def@ghi.jkl). If that data is pasted into name field of SharePoint's "Create" dialog when creating a new list or library, many of the characters will be dropped from the resulting URL. The URL will probably end up like this: ...\abc123%20defghi.jkl. Similar (or even identical) logic is applied when a K2 Blackpearl workflow creates a new list or library in SharePoint.

I have not found any documentation for what characters are kept, which are dropped, and which get URL encoded. Without that knowledge, I cannot ensure that the URLs I attempt to construct from the same data used to construct the library names will actually match the URLs created by SharePoint.

Secondary question:

If the generated URL matches an existing URL, what does SharePoint do? Throw an error, append a counter? Something else?

share|improve this question
add comment

1 Answer 1

If you create a list/library in the UI as MyList, the internal URL gets set as MyList. Users can go back later and rename it to My List for a better display, but it still remains MyList. If it is set as My List, it will be stored as My List, rendered as My%20List in the address bar of the browser.

Whatever you pass in on the initial create is what is stored. Users will generally not compact it and you should expect spaces in the value.

share|improve this answer
    
URL encoding of spaces does not cause a problem. However, SharePoint does a lot more than just encode spaces - it literally drops characters. So far, I know that hyhpens, forward and backward slashes, and parantheses get dropped. What other characters get dropped? Do any characters get converted to something else? Is there a list or some documentation? I've edited the question to better explain what I'm trying to do. –  Zarepheth Jan 14 '13 at 13:51
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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