1
votes

We have a document library that contains a list of proposals (InfoPath Forms). Users log in through SharePoint using Claims (Forms Auth, via an Extranet) who are from various organizations. The forms open in InfoPath on the client. The InfoPath form contains a field for what organization the proposal belongs to (a select list) that the user then selects when filling the form.

We have written a custom claims provider that augments each user's login with an organization claim.

When the user opens a proposal from SharePoint in the InfoPath form filler, we'd like to:

  • Pre-populate the organization select list with the organization matching the user's claim
  • Restrict the saving of the form (inserting and updating) if the user's claim value for organization does not match the selected organization on the form

I'm wondering how to get the claims information in InfoPath. Or, for ideas on how to do this server-side using a custom workflow/event receiver/web service (or something else).

2

2 Answers

0
votes

Here is a basic tutorial for getting claims from SharePoint 2010. Place this in the code behind of your InfoPath form. http://msdn.microsoft.com/en-us/library/ee535731.aspx

Ideally you want to call the code from the FormEvents_Loading method of your InfoPath form and if the user's organization is invalid, create a bool, that if false, will prevent the form from submitting. This would be done in the FormEvents_Submit method.

0
votes

I'm not sure if this works for your specific implementation however, you can set the data source for input controls (drop down lists, list boxes, etc) to be retreived from a web service.

You can then use hidden fields on the eForm which are populated with the metadata you need such as the user Id. These values are subsequently passed to the webservice and the return (List or whatever) are bound to the desired controls within the eForm.