Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

Can somebody please suggest me to set/change the view programatically in xsltlistviewwebpart from AllItems to something else, based on logged in user. Requirement is to find out the logged in user and based on that load the listviewwebpart with some view pertaining to that user.

Thanks for the help!!

share|improve this question
add comment

1 Answer

To do this programmatically you need to change the ListViewWebPart.ViewGuid property. There is sample code in the second part of this msdn blog post.

Before you start coding, have you considered using audiences? This will allow you to show different filtered lists or hide/show web parts based on the identity of the user or groups of users.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.