Ask a questionAsk a question
 

QuestionAccessing the current SPListItem in InfoPath Code Behind

  • Wednesday, November 04, 2009 3:25 PMDavid Lozzi Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    Hello,

    Thanks for your time. In the code behind of the InfoPath form, I need to get a SharePoint object representing the current IP form. I see that I can use the URL in the querystring to get my item, but I'm hoping there's a better way. I need to check the current user's permissions against the permissions of the item and show/hide functionality. 

    Thanks, 
    David Lozzi
    Delphi Technology Solutions
    Blog  |  LinkedIn | Twitter

All Replies

  • Wednesday, November 04, 2009 5:14 PMAshraf ul Islam Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    Hi David,

    You could add data connection that uses the form library as the source, then you can retrieve all available attributes for current item. Just make sure you check "Include data for the active form only" when selecting the item. 

    Please follow the steps,

    • Go to Tool -> Data Connections -> Add -> Create a new connection to: Receive Data -> Select Sharepoint library or list -> Enter the url of form library.
    • Select your Form Library and click Next, Choose fields from  list of available fields of Form Library. (Don't forget to check "Include data for the active form only").




    Ashraf ul Islam
    Sharepoint Consultant
  • Wednesday, November 04, 2009 5:41 PMDavid Lozzi Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     

    Thanks for your reply. Would this include the SharePoint permissions or just the item's meta data?


    David Lozzi
    Delphi Technology Solutions
    SharePoint & Dev Blog  |  LinkedIn | Twitter
    • Proposed As Answer byClayton Cobb Wednesday, November 04, 2009 7:24 PM
    • Unproposed As Answer byDavid Lozzi Wednesday, November 04, 2009 11:59 PM
    •  
  • Wednesday, November 04, 2009 7:24 PMClayton Cobb Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    Oops, accidentally hit the propose answer button.  Please remove that and delete my post, mods.  =P
    SharePoint Architect || My Blog