LastLogin is Null when pulled through Smartsheet API
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
-
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:
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
Categories
- All Categories
- 14 Welcome to the Community
- Customer Resources
- 64.9K Get Help
- 441 Global Discussions
- 140 Industry Talk
- 472 Announcements
- 4.9K Ideas & Feature Requests
- 129 Brandfolder
- 148 Just for fun
- 68 Community Job Board
- 496 Show & Tell
- 33 Member Spotlight
- 2 SmartStories
- 300 Events
- 36 Webinars
- 7.3K Forum Archives