Passing User Roles from Sharepoint - InfoPath Dev
in

InfoPath Dev

Passing User Roles from Sharepoint

Last post 06-12-2006 09:39 PM by infopathdude. 1 replies.
Page 1 of 1 (2 items)
Sort Posts: Previous Next
  • 06-01-2006 11:27 PM

    Passing User Roles from Sharepoint

    Hello Experts,
    I presume this is one of the frequently asked questions.
    I have a userform, once submitted by the end user alerts the reviewer to review it on sharpoint.I have a web part which will link the reviewer to the form , this form is retrieved by calling a webservice .
    Everythings working great so far, only problem I am struck with is
    I have two views designed for this userform (userview and reviewerview)
    And as per one of the experts recommendation I am switching the view to default view on page load event, thats working great too :)
    Now what I am trying to accomplish is when the reviewer clicks on the link I want to pass his userrole as a parameter to the webservice and when the form opens it should accept this userrole parameter in OnLoad event and switch his view.
    I have seen Collins article which explains abt passing params which uses merge form logic but here I dont want to have any user interaction,just wanna automate the process.
    Please give me some pointers if u have any suggestions.
    Appreciate your help in advance.
  • 06-12-2006 09:39 PM In reply to

    Re: Passing User Roles from Sharepoint

    I found sol to my own question so figured I will be helpful to others.
    What I did was addded a hidden text box to my infopath form which will store the userrole vals,so everytime infopath form loads it will check the val in the textbox and load the particulat view.
    Created a new aspx page and used the webservice to grab the xml from the database for the form.
    Next created an empty page and used the following code to run the infopath.exe from .Net
    Context.Response.ContentType = "application/ms-infopath.xml";
    Context.Response.AddHeader("content-disposition", "attachment; give_your_infopath_document_a_cool_name_here.xml");
    Context.Response.BinaryWrite( Encoding.UTF8.GetBytes (yourInfoPathDocumentAsXmlStringGoesHere));
    Context.Response.End();
    This aspx page had one query parameter (smartly used query parameter to get around the whole http handler issue)
    This query param being passed to the page is user role what it does is it will take the infopath xml and remove the xml node for userrole textbox and add a new xml(which is supposed to be for textbox in infopath) to the existing one with new userrole value.
    On infopath side on OnLoad event infopath will look at the textbox value and open the passed view depending on the userrole.
    Do you think it makes sense?
Page 1 of 1 (2 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.