Question:


We have the following requirement with respect to Notification, i.e We would like to notify the users and the Tenant Administrator whenever a document gets updated or deleted. In this scenario, We were able to send notification to user email id but not for tenant administrator, and when we use the below API it returns null value, Please clarify.


Below is the code that we are using to get tenant admin email id.

 

  

Tenant tenant = TenantProxy.GetTenantInfo(tenantId); 
string tenantAdminEmail = tenant.TenantAdminMembershipdetail.EmailId;

  

 


Answer:


You may not get the Tenant Admin membership details in Tenant object, because CelloSaaS allows you to assign Tenant Admin Role to many users, if so there may be more than one tenant Administrator for a Tenant at a given point of time. So the better approach to get the tenant administrator from Tenant Admin contact details.


Use the below method to get the contact details of the Administrator(s) from the Tenant Admin contact details.

  

// Get Tenant Admin user Ids
string[] adminUserIds = RoleProxy.GetUsersInRole(RoleConstants.TenantAdmin, UserIdentity.TenantID);
Dictionary<string, UserDetails> adminUserDetails = null;
if (adminUserIds != null && adminUserIds.Count() > 0)
{
	// Get the user details using user ids
	adminUserDetails = UserDetailsProxy.GetUserDetails(adminUserIds);
}