Show user that is logged in to my web application- but not to Groupdocs.com

Hello,

I am using your cloud API for GroupDocs to generate an embedded Annotation URL for a Document for that i am using your sample code(Sample 9 and sample 10) from “GroupDocs .Net SDK Samples” to embed the iframe into my application and to add the collaborator to doc to annotate.

When I upload and share the document with collaborator and When he logged in into his/her account and start commenting on document then in comment section on left hand side it shows “anonymous” above my comment line in the case when i am not logged in with the groupsdoc account in browser another tab.

So i want to show user that is logged in to my web application, but not to Groupdocs.com .

Could you please help me out?

Thanks & Regards
Priyanka

Hello Priyankame,

Thanks for getting in touch. The functionality you need is possible with our API. To show you how to implement such functionality we will prepare a sample, so you will be able to investigate is and see how you can use API to login your user. We will notify you as soon as the sample will be created.

Hello Priyankame,

Thank you for your patience. We created a sample for you. In this sample you can see how to sign annotations with not logged in GroupDocs user. You can check the sample here - http://groupdocs-dotnet-samples.apphb.com/Samples/sample38

Also you can click on “Docs for this sample” link which is located at the top right side of sample page, and you will find the code of this sample with comments.

Please check the sample and let us know if you need some additional help.

Hello Priyanka,

Thank you for your feedback. We tested your URL and could see that it’s correct and works well. Also we reproduced the issue you mentioned. To fix this issue you should be not logged in GroupDocs. Please try to logoff from http://apps.groupdocs.com/ , also you can try to clear cookies in your browser (but log off should be enough). After that please refresh your page with the iframe.

If you need more details, please feel free to contact us via support forum or by email.

If the user already exists i want to get Guid of that user.How can i get this?

Thanks

Hello Priyanka,

Thank you for your feedback. To fix this issue you should call “UpdateAccountUser” method only if user not exists in GroupDocs account. To check is user already exists you should use next code:

//Get all users from GroupDocs account
Groupdocs.Api.Contract.GetAccountUsersResult allUsers = service.GetAccountUsers();

if (allUsers != null)

{

  //Check is user allready exist in GroupDocs Account
  for (int i = 0; i < allUsers.Users.Length; i++)

  {

    if (firstName.Equals(allUsers.Users[i].FirstName))

    {

      //If user exist take his GUID
      userGuid = allUsers.Users[i].Guid;
      break;

    }

  }

  //If user GUID is empty (that implies that user not exist) create user
  if (userGuid == null)

  {

    //Create User info object
    Groupdocs.Api.Contract.UserInfo user = new Groupdocs.Api.Contract.UserInfo();
    //Create Role info object
    Groupdocs.Api.Contract.RoleInfo roleInfo = new Groupdocs.Api.Contract.RoleInfo();
    //Create array of roles.
    Groupdocs.Api.Contract.RoleInfo[] roleList = newGroupdocs.Api.Contract.RoleInfo[1];
    //Set user role Id. Can be: 1 - SysAdmin, 2 - Admin, 3 - User, 4 - Guest
    roleInfo.Id = 3;
    //Set user role name. Can be: SysAdmin, Admin, User, Guest
    roleInfo.Name = "User";
    roleList[0] = roleInfo;
    //Set nick name as entered first name
    user.NickName = firstName;
    //Set first name as entered first name
    user.FirstName = firstName;
    //Set last name as entered last name
    user.LastName = lastName;
    user.Roles = roleList;
    //Set email as entered email
    user.PrimaryEmail = email;
    //Creating of new User user - object with new user info
    Groupdocs.Api.Contract.UserIdentity newUser = service.UpdateAccountUser(user);
    // If request return's null return error to the template
    if (newUser.Guid != null)

    {

      //Get GUID of new user
      userGuid = newUser.Guid;

    } else

    {

      errorMessage = "Failed to create new user";

    }

  }

} else

{

  errorMessage = "Faild to get all users from account";

}

This code implements next logic:

  1. Get all users from GroupDocs account

  2. Compare user email from GroupDocs with email of your user

  3. If user exist – take his GUID and break loop

  4. If user not exist – create it by using “UpdateAccountUser” method

If you need more details, please feel free to contact us via support forum or by email.

Hello Priyanka,

Thank you for the additional details. We checked users with this email priyankame@smartdatainc.net and found out that this user is a GroupDocs user, so such user already exists and it’s not your account user. GroupDocs users and account users are different. Looks like you have two different GroupDocs accounts? You cannot access second account details using userId and privateKey from first account.

The process should be:

  1. You have one GroupDocs account

  2. You create “account users” under your groupdocs account using API Keys of the GroupDocs account.

  3. You work with created users.

If you have more questions, please feel free to get back in touch.

Hello Pavel,

Thanks for your response and help.

I have two questions in this regard.If you can help me on that.

1.As you mentioned here I can’t access the user with “Groupdocs Account” who has admin role.

for example :Suppose their is one admin account vinayp@smartdatainc.net and with this account Client Id and Private key i am trying to access another admin account Priyankame@smartdatainc.net.So this is not possible in Groupdocs ill get the same error as mentioned above.

Queries :-

  1. As i can see there is different type of role in groupdocs such as User,Admin,Syaadmin etc.So all the user that i ll add in the admin account need to have Groupdoc login account to annotate the doc or there is anyother way?
  2. What is difference between User and Collaborator here then ?

2.I want to send the email to all the Collaborator one by one.

for example: first it should go to user “A” and user “A” annotate the document and send to user “B” user “B” annotate the document and send to user “c” and so on with the notification in email to all who and what changes has been done so far.It is just like routing.

Thanks & regards

Priyanka

Hello Pavel,

Thanks for your response and help.

I have two questions in this regard.If you can help me on that.

1.As you mentioned here I can’t access the user with “Groupdocs Account” who has admin role.

for
example :Suppose their is one admin account vinayp@smartdatainc.net
and with this account Client Id and Private key i am trying to access
another admin account Priyankame@smartdatainc.net.So this is not
possible in Groupdocs ill get the same error as mentioned above.

Queries :-

  1. As
    i can see there is different type of role in groupdocs such as
    User,Admin,Syaadmin etc.So all the user that i ll add in the admin
    account need to have Groupdoc login account to annotate the doc or there
    is anyother way?
  2. What is difference between User and Collaborator here then ?

2.I want to send the email to all the Collaborator one by one.

for example: first it should go to user “A” and user “A” annotate the
document and send to user “B” user “B” annotate the document and send to
user “c” and so on with the notification in email to all who and what
changes has been done so far.It is just like routing.

Thanks & regards

Priyanka

This is for question 2 "I want to send the email to all the Collaborator one by one."I ll select the user from my application and the order in which the email will go.Suppose i select three users
User1,User2,User3 from my application and order to send email as

User1 set at order 1(e.g User1 get the email first before any of user(User2 or User3 )and he/she will do the annotation and then email goes to User 3 because his order is 2 )

User2 set at order 3(e.g User2 get the email after the annotation done by User 1 and User3)

User3 set at order 2((e.g User 3 will do the annotation and then email goes to User 2 because his order is 3)

At all point of annotation email notification will send to all users(User1,User2,User3).

Is there any way to achieve this functionality?If so then please help me in this regard.

Thanks
Priyanka

Hello Priyanka,

Thank you for your request. Please note that you don’t need several GroupDocs Login Accounts to implement multiuser working with the document. We have special Account Users that can be created under GroupDocs Login Account, and they are a part of this Main Account. You can have a number of such users depending on the Plan you have.

How to create such Account User via API we already explained. Also you can create and manage such users via GroupDocs for Cloud settings: My Account → Users. Please note, that to create such user you should provide his email and this email should be unique for all GroupDocs.com system.

Account Users don’t have passwords so you cannot login with these accounts on the GroupDocs.com website, but these accounts can be authorized via parameters in the annotation URL – we already described how and you successfully implemented this.

So:

In your web application you need only one Login Account . With its API Keys you can create and manage Account Users and generate URLs for them, and provide such URLs to your users.

For example if I’m one of your users and you want I participate in annotation of a file with you. You should provide a special URL to me so when I open it, I’ll be authorized in the GroupDocs. This URL can be opened in the iframe on your website, or such URL you can send to me via email.

Collaborator is a user that was added (invited) to the document to work/annotate on this document. With our API you can add/remove collaborators and see a list of them. When you have a list of collaborators for the document, you can get their user information and send notifications in your system or via email.

Currently we have no email notifications when user was added as a collaborator, but we are going to add such functionality in the next releases.

Many thanks,

Pavel

Pavel Teplitskiy

GroupDocs Dev support

Hello Pavel,

Thanks for giving such fantastic support.

As you described here

Collaborator is a user that was added (invited) to the document to work/annotate and necessary to have account with groupdocs.

And the user is the person who participate in annotation of a file but not necessary to have the account with Groupdocs

Only the difference that i can found here is that we add the user inside the Groupdocs admin account and in case Collaborator we dont need to add them in admin account they can logged in into GroupDocs directly with their login details .

So as i undersatnd Collaborator need to have the account with the group doc and user doesnot need to have it.

Correct me if i am wrong.

Thanks
Priyanka

Hello Priyanka,

Thank you for your request. When you have created an Account User - this user can view documents for example, but this user cannot annotate on the document. To allow this user add annotations - this user should be added to the Collaborators of this document. You can add to collaborators “Account Users” (that you created under your main GroupDocs Login Account) or any other GroupDocs Login Account user by their emails.

GroupDocs Login Account - you create it when you register new account on GroupDocs.com.

Account User - you create it via API under your GroupDocs Login Account.

Collaborator - any user or account that was added as a collaborator to the document via Annotation API. Such user can view and annotate documents.

If we can help you more please feel free to contact us via support forum or email.

With best regards

Pavel

Pavel Teplitskiy

GroupDocs Dev support

Hello Priyanka,

Thank you for your request. To avoid this problem email of new user that you create should be unique for all GroupDocs system. Also you can’t access GroupDocs account by using credentials from other GroupDocs account. For example if you create user with email test@test.com in Priyankame@smartdatainc.net account you can’t use same email to create user in Vinayp@smartdatainc.net account. Please use one GroupDocs account, this will give you opportunity to check if this email already in use.

If we can help you more please feel free to contact us via support forum or email.

With best regards

Pavel

Pavel Teplitskiy

GroupDocs Dev Support

Hello Pavel,

Thanks for the helping me again.

It has been clear that we cannot add same emailid into two different account.

So do we have any method through which we can get “userGuid” who is already added in GroupDocs system that can be used if we get the error “user with the same name already registered…”.

Thanks & Regards
Priyanka

In continue to above post.

I only want the user Guid of already added user in GroupDocs account.

Thanks in advance
Priyanka

In continue to above post.

I only want the user Guid of already added user in GroupDocs account so that i can share the document with already added user.

Thanks in advance
Priyanka

Hello Priyanka,

Many thanks for getting in touch.

Sure, you can get the user GUID using this code:

Groupdocs.Api.Contract.GetAccountUsersResult allUsers = service.GetAccountUsers();
for (int i = 0; i < allUsers.Users.Length; i++)

{

  if (email.Equals(allUsers.Users[i].PrimaryEmail))

  {

    //If user exist take his GUID
    userGuid = allUsers.Users[i].Guid;
    break;

  }

}

P.S. You can get the user GUID from only one account from which you use Client ID and Private Key.

If you need more help, please feel free to contact us via our support forum: https://forum.groupdocs.cloud/ or email: support@groupdocs.com

Kind regards,

Pavel Teplitskiy

GroupDocs Dev Support