cancel
Showing results for 
Search instead for 
Did you mean: 
Announcements
Update: Find information on Dropbox support during COVID-19 here
Close
cancel
Showing results for 
Search instead for 
Did you mean: 

Get user's account info

Alex_Shekunsky
Explorer | Level 4

Hi!

I need help.

How i can get linked user's dropbox account info (name/email) in Objective-c by API v2 ?

In v1 i did this by 

[self.restClient loadAccountInfo];

in method:

- (void)restClient:(DBRestClientclient loadedAccountInfo:(DBAccountInfoinfo

Thanks!

1 Accepted Solution

Accepted Solutions

Re: Get user's account info

Dropboxer
Dropboxer

If you're using the API v2 Objective-C SDK, the equivalent method is getCurrentAccount:

 

https://dropbox.github.io/dropbox-sdk-obj-c/api-docs/latest/Classes/DBUSERSRoutes.html#/c:objc(cs)DB...

 

Here's an example of how you would make an "RPC-style" request like that (for creating a folder in this case):

 

https://github.com/dropbox/dropbox-sdk-obj-c#rpc-style-request

 

Xcode should auto-complete most of the boilerplate code for you though.

View solution in original post

3 Replies 3

Re: Get user's account info

Dropboxer
Dropboxer

If you're using the API v2 Objective-C SDK, the equivalent method is getCurrentAccount:

 

https://dropbox.github.io/dropbox-sdk-obj-c/api-docs/latest/Classes/DBUSERSRoutes.html#/c:objc(cs)DB...

 

Here's an example of how you would make an "RPC-style" request like that (for creating a folder in this case):

 

https://github.com/dropbox/dropbox-sdk-obj-c#rpc-style-request

 

Xcode should auto-complete most of the boilerplate code for you though.

View solution in original post

Re: Get user's account info

Alex_Shekunsky
Explorer | Level 4

Thank you very much!

Re: Get user's account info

tomsax New member | Level 2
New member | Level 2

If you have a DBUserClient object (e.g. from [DBClientsManager authorizedClient]), you can get the info for that account with this call:

 

[[client.usersRoutes getCurrentAccount] setResponseBlock:^(DBUSERSFullAccount * _Nullable result, DBNilObject * _Nullable routeError, DBRequestError * _Nullable networkError)
{
	if (networkError != nil)
	{
		NSLog(@"getCurrentAccount failed: network error");
	}
	else if (routeError != nil)
	{
		NSLog(@"getCurrentAccount failed: route error");
	}
	else
	{
		NSLog(@"got Dropbox account email: %@", result.email);
	}
}];

Work Smarter with Dropbox

The way we work is changing. Share and discover new ways to work smarter with Dropbox in our community.

Sound good? Let's get started.
Who's talking

Top contributors to this post

What do Dropbox user levels mean?
Need more support?