Author Topic: Create Folder type Site  (Read 409 times)

Offline carpio

  • Newbie
  • *
  • Posts: 33
  • Karma: 0
Create Folder type Site
« on: August 15, 2018, 11:56:04 PM »
I'm trying to create a folder of type Site but get the error "No Permission to create object under this folder)

Here my test code:

CfgFolder folder = new CfgFolder(service);
folder.Name = "TEST";
folder.FolderClass = CfgFolderClass.CFGFCSite;
folder.Type = (CfgObjectType)22;
folder.OwnerID.DBID = ten.DBID;
folder.Save();


What am I missing?

Offline cavagnaro

  • Administrator
  • Hero Member
  • *****
  • Posts: 6758
  • Karma: 56332
Re: Create Folder type Site
« Reply #1 on: August 16, 2018, 01:04:27 AM »
The user you are using has no perm to create objects on that folder. Check it via CME first

Enviado de meu E6633 usando o Tapatalk


Offline carpio

  • Newbie
  • *
  • Posts: 33
  • Karma: 0
Re: Create Folder type Site
« Reply #2 on: August 16, 2018, 05:41:02 AM »
Created a folder with my user in cme and it worked.
Did this first to make sure I use the correct values to create a site.

Offline terry

  • Sr. Member
  • ****
  • Posts: 256
  • Karma: 32
Re: Create Folder type Site
« Reply #3 on: August 16, 2018, 06:57:13 AM »
Shouldn't you also provide owner type and also may be parent's object type and DBID?

Offline carpio

  • Newbie
  • *
  • Posts: 33
  • Karma: 0
Re: Create Folder type Site
« Reply #4 on: August 16, 2018, 10:00:26 PM »
For folders on top layer i usually never set the owner or parent.
I have tried to set this for the site folder but also no result.
I have tried to set the owner to tenant.

Offline cavagnaro

  • Administrator
  • Hero Member
  • *****
  • Posts: 6758
  • Karma: 56332
Re: Create Folder type Site
« Reply #5 on: August 16, 2018, 10:08:36 PM »
What does CfgServer logs say?
Try to compare a CME call VS yours


Enviado de meu E6633 usando o Tapatalk


Offline carpio

  • Newbie
  • *
  • Posts: 33
  • Karma: 0
Re: Create Folder type Site
« Reply #6 on: August 17, 2018, 05:42:13 PM »
I have compared the logs and saw that when i create a site folder in cme i have a ownerid
<CfgFolder
  DBID="0"
  name="TEST_CME"
  type="22"
  state="1"
  folderClass="2">
 <ownerID>
  <CfgTenantOwnerShortcut
    linkDBID="1"  />
 </ownerID>
 <userProperties />
</CfgFolder>

Im now trying to set the owner id but i get always a error"object reference not set to an instance of an object"
my OwnerId is also null.

here is the code i try:

CfgFolder folder = new CfgFolder(func.app_service);
            folder.Name = "TEST";
            folder.FolderClass = CfgFolderClass.CFGFCSite;
            folder.Type = (CfgObjectType)22;
            folder.OwnerID.DBID = func.app_tenant.DBID;
            folder.Save();




Offline seaofwires

  • Newbie
  • *
  • Posts: 1
  • Karma: 0
Re: Create Folder type Site
« Reply #7 on: December 05, 2018, 04:09:32 AM »
Posting this here for anyone else that runs into this problem.  I was able to fix the issue by assigning the folder.folderID value to the parent folder's DBID that I wanted to create the folder under.