Hi,

How do I programatically find the GUID for the Sharepoint List View given that the name of the view is known. A user has to input the view name and the program should be able to spit out its GUID.

Thanks.

Recommended Answers

All 3 Replies

Thanks Momerath. I have been trying to use that page as a help before I posted here. No Luck! I have no idea how to implement it in my code and what libraries to import to make it work.

Well I figured it out. For anyone who might stumble upon this problem in the future. here's the solution :

                SPWeb web = SPContext.Current.Web;
                SPList list = web.Lists["your-list-name"];
                Guid viewId = list.Views["your-view-name"].ID;
                some_random_label.Text = "The view GUID is :" + viewId.ToString("B");
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.