Documentation for creating iParts? Where

I am trying to create some iParts to replace some old xTender applets.

I am very familiar with creating web parts and have created a number of iParts successfully. What I am not able to find is any information on what values, variables and parameters are available to me inside those iParts. i.e. How do I retrieve the selected user ID?

Is this documentated someplace?

This would be for both web and desktop views.

Thanks

J

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

Selected User ID in the web

Hi J,

I don't think there is any documentation as to what is available to you inside of iParts.  Perhaps looking at ETP examples will help get you what you need or using .NET reflector to see what you can access using the Asi dlls.

I'm not sure how you would retrieve information for iParts running in the desktop.  Maybe someone with more OMNIS experience can help you there.

But I can tell you how to get the selected user ID in the web view.  After referencing the Secure.dll in your iPart project this will check the 3 most common methods used to store the selected iMIS ID:

// First look for the ID in the URL, then check the cookie for impersonation or lastly use teh logged in user's id                  
if (!string.IsNullOrEmpty(Request.QueryString["ID"]))
    partyId = Request.QueryString["ID"];
else if (Request.Cookies["UserID"] != null && !Request.Cookies["UserID"].Value.Equals(string.Empty))
    partyID = new Secure().Decrypt(Request.Cookies["UserID"].Value);
else if (AppPrincipal.CurrentIdentity.IsAuthenticated && AppPrincipal.CurrentIdentity.ContactMaster.Length > 0)
    partyId = AppPrincipal.CurrentIdentity.ContactMaster;

After you have the ID, you should be able to access almost everything you need via Soa or iBO.

Good luck,
Courtney Robertson

Works on Web but not in Omnis

Thanks Courtney.

You code was helpful for web. I'm still struggling with the Omnis environment.

Best solution I've found so far is to build an extender, which is what I am really trying to avoid, that throws the selected Id into a session or cookie and then read it on the .net side.

Pretty much a hack that I want to avoid.

John

Use IBOs

We regularly build iParts and access all the user data through IBOs

For example a member Profile iPart would code that looks like this  (gets first and last name):


 

Asi.iBO.iboAdmin.InitializeSystem();

Asi.iBO.ContactManagement.CContact contact = Asi.ContentManagerNet.SessionState.Contact;

    FirstNameLB.Text = contact.FirstName;
    LastNameLB.Text = contact.LastName;

 


 

To get the User ID use this:


 

String UserID ="";
        if (Asi.Security.AppPrincipal.CurrentIdentity.IsAuthenticated && Asi.Security.AppPrincipal.CurrentIdentity.ContactMaster != "")
        {
            UserID = Asi.Security.AppPrincipal.CurrentIdentity.ContactMaster;
        }

 


 

However you don't need the User ID if you create a CContact object like above.

There is a lot more infor about IBOS here:

 
Hope this Helps
 
James Harrison
www.visualantidote.com

 

This works great for web but not Desk view

Your code is fine for web iParts but it returns the logged in user instead of the selected user in Desk view (omnis).

I have munged together a Xtender that puts the selected ID into a cookie (I hate to use cookies) that I can then pickup inside the iPart and use in conjunction with the IBOs to present the information that I need.

It works but it just feels very wrong to have to mung this stuff together like that. Oh well maybe in the next go round of iMIS.

J