Logo 
Search:

Sharepoint Forum

Ask Question   UnAnswered
Home » Forum » Sharepoint       RSS Feeds

Guid of all document libraries

  Asked By: Elvis    Date: Aug 09    Category: Sharepoint    Views: 962

my customer wants to get the guid of all document
libraries:
I am giving the following snippet:
private string GetCurrentDocumentLibraryID()
{
string serverVariable_SCRIPT_NAME;
string aspxFileName;
string result; SPWeb web =
SPControl.GetContextWeb(this.Context);

serverVariable_SCRIPT_NAME =
this.Context.Request.ServerVariables["SCRIPT_NAME"];
aspxFileName =
System.IO.Path.GetFileName(serverVariable_SCRIPT_NAME);


result =
serverVariable_SCRIPT_NAME.Replace(web.ServerRelativeUrl
+ "/", "");
result = result.Replace(aspxFileName, "") +
"AllItems.aspx"; SPView view =
web.GetViewFromUrl(SPEncode.UrlEncode(result));

if (view != null)
return view.ParentList.ID.ToString();
else
return "";
}

The problem is the format of the URL the
GetViewFromUrl(...) function need. Do
you have any idea how to have the same result, but in
an object programing way ?

Share: 

 

No Answers Found. Be the First, To Post Answer.

 
Didn't find what you were looking for? Find more on Guid of all document libraries Or get search suggestion and latest updates.




Tagged: