Rahul Khanna

Rahul Khanna

  • NA
  • 236
  • 0

How to change of item url in sharepoint 2010 document librar

Dec 22 2013 9:19 AM
Hi, 
I am working on changing the item url of sharepoint 2010 document library programatically. Once user click on a document in the library the document should redirect to the NewItemURL, for this I have written the below code but its not giving the expected result. Could somebody please help me out on this.
string oldItemURL = item.Web.Url + "/" + item.File.Url;
string NewItemURL = "/Sites/MyTestSite/_layouts/MyCustomApplicationPage/MyCustomApplicationPage.aspx?ItemId=" + docID;
item.Url.Replace(oldItemURL, NewItemURL);
item.Update();

Answers (1)