Tuesday 22 July 2014

document library file download link path


we have to easily will get the direct document library file path.

below this scenario is go for directly will get file read or download purpose.
"
string itemUrl2 = (SPContext.Current.Site.Url +"/" +spweb+ "/" + splist2 + "/" + url3);

"



 SPQuery query2 = new SPQuery();
                           query.Query = "<OrderBy><FieldRef Name='Modified' Ascending='False' /></OrderBy>";
                            query.ViewAttributes = "Scope= \"Recursive\"";

                                        SPList splist2 = spweb.Lists["ComAnnouncement"];

                                        SPListItemCollection items = splist2.GetItems(query2);

                                        foreach (SPListItem item in items)
                                        {

                                            string url3 = item["Name"].ToString();



                                            string itemUrl2 = (SPContext.Current.Site.Url +"/" +spweb+ "/" + splist2 + "/" + url3);


                                            dtrow["AttachmentUrl"] = itemUrl2;
                                        }

No comments:

Post a Comment