Please ensure Javascript is enabled for purposes of website accessibility
Powered by Zoomin Software. For more details please contactZoomin

AVEVA™ Work Tasks

Create User Context

  • Last UpdatedJun 10, 2024
  • 2 minute read

For every control, the AVEVA Work Tasks User Context object must get instantiated. Find below the steps to create User Context Object.

To create User Context Object

  1. Before creating user context object, Create an ASP.NET Project in Visual Studio .NET.

  2. Go to UserContext.aspx.cs page.

  3. Create a user context object.

    using System;

    using System.Collections;

    using System.Configuration;

    using System.Data;

    using System.Linq;

    using System.Web;

    using System.Web.Security;

    using System.Web.UI;

    using System.Web.UI.HtmlControls;

    using System.Web.UI.WebControls;

    using System.Web.UI.WebControls.WebParts;

    using System.Xml.Linq;


    public partial class CreatingUserContext : System.Web.UI.Page

    {

    protected void Page_Load(object sender, EventArgs e)

    {

    Work Tasks.Entity.UserContext userContext = new Work Tasks.Entity.UserContext("john", new Skelta.Core.ApplicationObject("LeaveReportsRepo"), "activedirectory");

     

    }

    }

The UserId value varies based on the authentication provider configured. This value should have the Entity instance mapped for the repository to be prefixed along with real id of the user.


  • If the repository is mapped to AVEVA Work Tasks List user provider, the UserIdString will be skeltalist::[GUID]. Here the GUID is of the user "john", taken from SKEUsers table present in the Repository DB.

Example: skeltalist:: C99B4110-C8CC-410B-BF70-93F3A7E34EDF

That is, User object will be created as:

Skelta.Entity.UserContext userContext = new Skelta.Entity.UserContext("C99B4110-C8CC-410B-BF70-93F3A7E34EDF", new Skelta.Core.ApplicationObject("LeaveReportsRepo"), "skeltalist");  

  • If the repository is mapped to the Active Directory user provider, the UserIdString will be activedirectory::[samAccountName]. Here, samAccountName is an active directory property value.

For example: activedirectory::john

That is, the user object will be created as:

Skelta.Entity.UserContext userContext = new Skelta.Entity.UserContext("john", new Skelta.Core.ApplicationObject("LeaveReportsRepo"), "activedirectory");  

  • If the repository is mapped to the Forms user provider, the UserIdString will be sqlprovider::[UniqueIdentifier]. Here UniqueIdentifier is the unique identifier id for resource.

For example: sqlprovider::6fb03011-68b7-437e-972e-21c67e4e2fe7

That is, the user object will be created as:

Skelta.Entity.UserContext userContext = new Skelta.Entity.UserContext("6fb03011-68b7-437e-972e-21c67e4e2fe7", new Skelta.Core.ApplicationObject("LeaveReportsRepo"), "sqlprovider");

  • If the repository is mapped to ASP.NET Membership user provider, the UserIdString will be membershipprovider::[UniqueIdentifier]. Here, UniqueIdentifier is the unique identifier id for resource.

For example: membershipprovider::a9bfc969-cc82-4c4b-99b9-50d9e1a91c01

That is, the user object will be created as:

Skelta.Entity.UserContext userContext = new Skelta.Entity.UserContext("a9bfc969-cc82-4c4b-99b9-50d9e1a91c01", new Skelta.Core.ApplicationObject("LeaveReportsRepo"), "membershipprovider");

 

TitleResults for “How to create a CRG?”Also Available in