LastLogin is Null when pulled through Smartsheet API

michael_hostetler85551
edited 12/09/19 in API & Developers

I'm using C#.  After authenticating, the following code returns null for all LastLogins.  It works for other fields I'm pulling such as Id, Name, Email, SheetsOwned, etc.  Is there an issue with that particular field coming through the API?  Since it is a date field, does it need to be treated differently, though I am only attempting to display it to my console at the moment?  Can anyone else confirm if the issue exists for them?

PaginatedResult<User> usersX = smartsheet.UserResources.ListUsers(null, null);

foreach (User vUser in usersX.Data)

   {

      Console.WriteLine(vUser.LastLogin);

  }

 

Thanks, Mike

Comments

  • dave-inden
    dave-inden ✭✭✭

    Doing this request in Postman I didn't have a lastLogin attribute on the user objects returned. According to the Smartsheet API docs in the Parameters section you have to provide the include query string with a value of lastLogin to have that data included in the user object. Doing the request with that query string set gave me the lastLogin attribute on the user object.

    GET /users?include=lastLogin

    Looking at your code you provided it doesn't look like you are setting any query parameters for the request. I would try that and see if you can get the lastLogin attribute to be included.

  • Thanks.  I cannot figure out the syntax in C# to pass the parameter.  In looking at the documentation on this link:

    http://smartsheet-platform.github.io/smartsheet-csharp-sdk/html/ac0b2c93-6e3f-76cb-9ac1-615f348772a2.htm

    the ListUsers Method has 2 fomats...one with 2 parameters and one with 3, with the middle parameter being the ListUserInclusion option.  However, in my code, ListUsers is only allowing the 2 parameter option.  Furthermore, ListUserInclusion is not even in my library of words to use in my code.  If anyone can offer assistance, it would be greatly appreciated.  Thanks, Mike