cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Announcements
Want to know what we learned at IBC? Check out our learnings on media, remote working and more right here.

Dropbox API Support & Feedback

Find help with the Dropbox API from other developers.

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Use RootNameSpaceId or HomeNameSapceId

Use RootNameSpaceId or HomeNameSapceId

Gags
Helpful | Level 6
Go to solution

Hello @Greg-DB 

 

We have developed a migration app that one of our customers used for migration files from Windows to Dropbox.

The migration worked fine except that the files were migrated in a different folder from the one selected by customer.

I then read Dropbox Team Files Guide: https://developers.dropbox.com/dbx-team-files-guide

 

Dropbox for Business Account we used for dev testing is set up as Team Folder Configuration where RootNameSpaceId and HomeNameSpaceId  are same and so we did not face issue during migration.  However, our customer Dropbox for  Business Account is set us as Team Spaces where RootNameSpaceId and HomeNameSpaceId  are different.  This seems to be the most probable reason for files being migrated to a different folder for our customer.

 

We need to ensure that our application should be able to migrate files for both the Dropbox for Business configurations i.e. Team Space as well as Team Folder configuration.

 

I found out  that we can use either RootNamespaceId or HomeNamespaceId as per the code snippet below:

 

DropboxApi.Users.FullAccount acc = await clientadmin.Users.GetCurrentAccountAsync();
string rootnamespace = "";

if (acc != null && acc.RootInfo != null && acc.RootInfo.RootNamespaceId != null)
{
rootnamespace = acc.RootInfo.RootNamespaceId;
//rootnamespace = acc.RootInfo.HomeNamespaceId;
}

clientadmin = clientadmin.WithPathRoot(new PathRoot.NamespaceId(rootnamespace));

 

 

Which one is used by default if we don't set  WithPathRoot - RootNameSpaceID or HomeNameSpaceID ?

 

From what I  understand, we need to use HomeNameSpaceID if we need to create files and folders via Dropbox APIs in user's personal folders and RootNameSpaceID if we we want to create files and folders in user's team folders.  Is that correct ?

 

Please confirm which NameSpaceID to use in our case where we want to create file in User 's own personal folder for  both Team space and Team folder Dropbox Business configurations?

 

Thanks,

Gagan

 

1 Accepted Solution

Accepted Solutions

Здравко
Legendary | Level 20
Go to solution

@Gags wrote:

...

Which one is used by default if we don't set  WithPathRoot - RootNameSpaceID or HomeNameSpaceID ?

...


Hi @Gags,

By default 'HomeNameSpaceID' is in use when nothing set explicitly.

 


@Gags wrote:

...

From what I  understand, we need to use HomeNameSpaceID if we need to create files and folders via Dropbox APIs in user's personal folders and RootNameSpaceID if we we want to create files and folders in user's team folders.  Is that correct ?

...


Hm.. 🤔 No exactly. Yes, if you want to access everywhere particular user of your application has access to (including it's own folder), you have to set 'RootNameSpaceID'. If you want to have access to user's member folder only, you can use any of 'RootNameSpaceID' or 'HomeNameSpaceID' (or not set).

 


@Gags wrote:

...

Please confirm which NameSpaceID to use in our case where we want to create file in User 's own personal folder for  both Team space and Team folder Dropbox Business configurations?

...


As I said, you can use whatever you want (including not set anything at all). You should keep in mind that all path you will set in API calls to addressing files/folders will be relative to selected namespace (the home when nothing selected), something you, as seems, have ignored and that's where your issues are coming from.

Here, if I have to bet, you want to use absolute account address (as seems). To achieve this it's convenient to always set 'RootNameSpaceID' regardless of actual account configuration. 😉

Hope this helps.

View solution in original post

6 Replies 6

Здравко
Legendary | Level 20
Go to solution

@Gags wrote:

...

Which one is used by default if we don't set  WithPathRoot - RootNameSpaceID or HomeNameSpaceID ?

...


Hi @Gags,

By default 'HomeNameSpaceID' is in use when nothing set explicitly.

 


@Gags wrote:

...

From what I  understand, we need to use HomeNameSpaceID if we need to create files and folders via Dropbox APIs in user's personal folders and RootNameSpaceID if we we want to create files and folders in user's team folders.  Is that correct ?

...


Hm.. 🤔 No exactly. Yes, if you want to access everywhere particular user of your application has access to (including it's own folder), you have to set 'RootNameSpaceID'. If you want to have access to user's member folder only, you can use any of 'RootNameSpaceID' or 'HomeNameSpaceID' (or not set).

 


@Gags wrote:

...

Please confirm which NameSpaceID to use in our case where we want to create file in User 's own personal folder for  both Team space and Team folder Dropbox Business configurations?

...


As I said, you can use whatever you want (including not set anything at all). You should keep in mind that all path you will set in API calls to addressing files/folders will be relative to selected namespace (the home when nothing selected), something you, as seems, have ignored and that's where your issues are coming from.

Here, if I have to bet, you want to use absolute account address (as seems). To achieve this it's convenient to always set 'RootNameSpaceID' regardless of actual account configuration. 😉

Hope this helps.

Gags
Helpful | Level 6
Go to solution

Hello @Здравко 

 

Thank-you for answering.

 

As I understand, I  should set RootNameSpace  everywhere in my Dropbox API  calls in my scenario as in the code snippet below.

Dropbox.Api.Users.FullAccount acc = await clientadmin.Users.GetCurrentAccountAsync();
string rootnamespace = "";

if (acc != null && acc.RootInfo != null && acc.RootInfo.RootNamespaceId != null)
{
      rootnamespace = acc.RootInfo.RootNamespaceId;
}

clientadmin = clientadmin.WithPathRoot(new PathRoot.NamespaceId(rootnamespace));

I am getting the issue because the Default Namespace used is HomeNameSpace.

Is  that  correct ?

 

In order to test my changes I would need a Dropbox Business using Team Space configuration.

How do I convert my existing Dropbox Business from Team Folder configuration to Team Space configuration ?

 

Thanks,

Gagan

Здравко
Legendary | Level 20
Go to solution

@Gags wrote:

...

As I understand, I  should set RootNameSpace  everywhere in my Dropbox API  calls in my scenario ...


It's matter of design decision, not something mandatory. I conditionally proposed it since the description in your OP was sounding so. If I was wrong... finally it's your decision.

 


@Gags wrote:

...

I am getting the issue because the Default Namespace used is HomeNameSpace.

Is  that  correct ?

...


Hm.. 🤔 No exactly, 🙂 again. Yes, as I said before, the default namespace, if nothing else set, is the member's home namespace. It's not some issue mandatory, in spite in your case may appear as such and most probably is. The actual issue is, as I said, you haven't accounted used namespace (the home one in particular) that serves as base for all path to files/folders used in API calls (i.e. the same path with different namespace will lead to different real place - all paths are relative to the namespace in use). In this context another solution can be path correction or let the user select desired path after listing all available. All paths in the list are with correct path based on the whatever namespace set (or not set namespace). You can use folder id too. Again changing namespace suppose different path! Just don't forget it.

 


@Gags wrote:

...

In order to test my changes I would need a Dropbox Business using Team Space configuration.

How do I convert my existing Dropbox Business from Team Folder configuration to Team Space configuration ?

...


To be honest I'm not aware of all those details, but you may have received an email notification asking if you’d like to upgrade your account to the new Dropbox business. Check this and do whatever needed.

Good luck.

Greg-DB
Dropbox Staff
Go to solution

@Gags It looks like Здравко already helpfully answered your questions, but let us know if you still need help with anything.

Gags
Helpful | Level 6
Go to solution

Thank-you @Здравко . We have resolved the issue by using RootNamespaceId for our Customer.

 

@Greg-DB , 

In order to test my changes in our QA environment, I would need Dropbox Business using Team Space configuration. How do I convert my existing Dropbox Business from Team Folder configuration to Team Space configuration ?

 

Thanks,

Gagan

Greg-DB
Dropbox Staff
Go to solution

@Gags For help with the configuration of your team, please contact support from an admin account on the team.

Need more support?
Who's talking

Top contributors to this post

  • User avatar
    Greg-DB Dropbox Staff
  • User avatar
    Gags Helpful | Level 6
  • User avatar
    Здравко Legendary | Level 20
What do Dropbox user levels mean?