Partager via


Using Data View Web Part to Limit What Entries Users See

Had a major epiphany today on how to handle a long standing issue.   I love demoing InfoPath paired with a Windows SharePoint Services 2.0 Form Library.   It's an awesome end to end solution that is cheap and easy to understand and set up.   The problem has always been that it's not really possible to easily make it so that a user of the solution can only see their posts and no one else's.   WSS 2.0 doesn't have item level security, so it's not really possible to lock it down.   I've seen solutions that involve publishing a form in one place, but having the output of the form go to a different library that is obfusacted and not immediately obvious to the end user.   I've also seen entries moved programmatically out of one library and pushed into another.   BizTalk has a SharePoint adapter that can do this too, although apparently it's unsupported.    So the technique I've discovered is the use of a Data View web part to expose a particular view of a library in a different page, generally the home page of a team site.   What you do is spin up your team site, add a form library to it, and then crack open the solution in FrontPage 2003.   In FP, click below the last webpart on the home page of the site, and then select Insert | Database | Data View.   From here you can pick the SharePoint Library that you'd like to use as a datasource.   It's very easy.   In the filter properties you can opt to filter based on Created By equals [current user].   That basically gives you a web part on the home page of the site that only shows the stuff you own.   It's not a full solution, especially since you can add the Encoded Absolute URL field as a hyperlink to the form, which shows the end user where the library is.  Still, it does show the individual just their entries and doesn't require them to pick any special view by default.