Select to view content in your preferred language

Attribute Query: List with View

726
1
Jump to solution
10-10-2012 12:00 PM
GarrettMoeller
Deactivated User
Greetings-
Do you have to do something special when querying a list with a view?

Normal:
List citiesList = web.Lists.GetByTitle("2012 List"); //Which I guess queries AllItems??

With View
List citiesList = web.Lists.GetByTitle("2012 List.ViewName");  //Something like that for a view?
0 Kudos
1 Solution

Accepted Solutions
ShawnNelson
Emerging Contributor
Views are a property of a List. Therefore, you would do something like:

List citiesList = web.Lists.GetByTitle("2012 List");
View citiesView = citiesList.Views.GetByTitle("Your View");

View solution in original post

0 Kudos
1 Reply
ShawnNelson
Emerging Contributor
Views are a property of a List. Therefore, you would do something like:

List citiesList = web.Lists.GetByTitle("2012 List");
View citiesView = citiesList.Views.GetByTitle("Your View");
0 Kudos