Thursday, August 1, 2013

How to get attached file url in sharepoint

Hi Friends,

I was searching one solution like "how can i have url of Attached item ?", but mostly i got hard coding
:(

mostly searched solution is like this

"/you Stie/List/Your list name/Attachments/" + item("ID").ToString() + "/" + obj.ToString

and this is really bad to use.
But now i have explored Sharepoint and get solution, and its very simpl.


Here is the solution.
 dim _url as string= item.Attachments.UrlPrefix.ToString + item.Attachments.Item(0).ToString

1) item.item.Attachments.UrlPrefix
it will return till id value in the form of url

2) item.Attachments.Item(0).ToString


This will return the item name that we need by this solution we will have our url of Attached item

I hope this will helpful for you, If u are facing any problem regarding of this plz let me know through ur post

No comments:

Post a Comment