How to Retrieve the Signed-In User ID in Navisworks for Use with Entitlement APIs?

tarekahmed136
Participant

How to Retrieve the Signed-In User ID in Navisworks for Use with Entitlement APIs?

tarekahmed136
Participant
Participant

I’m developing a plugin for Navisworks using the .NET API and need to retrieve the Autodesk user ID of the currently signed-in user. This is required to validate their subscription or license status using the Entitlement APIs.

 

However, I couldn’t find any specific reference to Navisworks in the Entitlement API documentation—it only mentions AutoCAD, Revit, and Inventor.

 

I attempted to use the following code, but it doesn’t return the correct user ID:

 

private static string GetUserId()
{
    string userId = string.Empty;
 
    Autodesk.Internal.InfoCenter.InfoToolbar autodeskInformaton = ComponentManager.InfoCenterToolBar;
    for (int i = 0; i < autodeskInformaton.Items.Count; i++)
    {
        if (autodeskInformaton.Items[i] is Autodesk.Internal.InfoCenter.WebServicesLoginButton)
        {
            userId = (autodeskInformaton.Items[i] as Autodesk.Internal.InfoCenter.WebServicesLoginButton).Text;
        }
    }
 
    return userId;
} 

 

Is there a proper way to retrieve the signed-in Autodesk user ID in Navisworks to use with the Entitlement APIs? Any help or alternative suggestions would be greatly appreciated.

 

0 Likes
Reply
Accepted solutions (1)
199 Views
2 Replies
Replies (2)

tarekahmed136
Participant
Participant

The provided code retrieves the text from the textbox in the Navisworks toolbar, but this text does not necessarily represent the user ID.

0 Likes

naveen.kumar.t
Autodesk Support
Autodesk Support
Accepted solution

Hi @tarekahmed136 ,

 

This code uses the Navisworks API to access the username and user ID of the currently signed-in user.

string userName = Autodesk.Navisworks.Api.Application.Gui.SignInUserName;
string userId = Autodesk.Navisworks.Api.Application.Gui.SignInUserId;

 


Naveen Kumar T
Developer Technical Services
Autodesk Developer Network