Create Folder type Site

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?

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

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.

Shouldn’t you also provide owner type and also may be parent’s object type and DBID?

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.

What does CfgServer logs say?
Try to compare a CME call VS yours

Enviado de meu E6633 usando o Tapatalk

I have compared the logs and saw that when i create a site folder in cme i have a ownerid





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();

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.

I have tried to set the folder id to the tenant but get a Exception that a required attribute was still missing.

CfgFolder site = new CfgFolder(service);
site.Name = “Test”;
site.Type = CfgObjectType.CFGFolder;
site.FolderClass = CfgFolderClass.CFGFCSite;
site.FolderId = WellKnownDbids.EnvironmentDbid;
site.Save();

Do I miss here something?

? Have you read the post above yours?

Enviado de meu SM-G9650 usando o Tapatalk