[Connect C++ MicrostationApi] Create new Workset with the c++ Api

Hello,

I'm trying to create a new Workset in an existing Workspace. At the moment I can successfully load  The Workset List of the existing Workspace. But then I don't really know how to proceed. 

The Code I tried is :


//This is Working:
DgnDocumentMonikerPtr wspCfgMoniker = DgnDocumentMoniker::CreateFromFileName(L"C:\\ProgramData\\Bentley\\MicroStation CONNECT Edition\\Configuration\\WorkSpaces\\RPS.cfg");
DgnFolderMonikerPtr cfgFolderMoniker = DgnFolderMoniker::CreateFromFolderName(L"C:\\ProgramData\\Bentley\\MicroStation CONNECT Edition\\Configuration");
DgnWorkSpacePtr workSpace = DgnWorkSpace::Read(*wspCfgMoniker, *cfgFolderMoniker);
WorkSetCollection wsList = workSpace->GetWorkSets();

//not working:
DgnDocumentMonikerPtr dgnwsmoniker = DgnDocumentMoniker::CreateFromFileName(L"C:\\ProgramData\\Bentley\\MicroStation CONNECT Edition\\Configuration\\WorkSpaces\\Template\\Template.dgnws");
DgnDocumentMonikerPtr wsCfgMoniker = DgnDocumentMoniker:: CreateFromFileName(L"C:\\ProgramData\\Bentley\\MicroStation CONNECT Edition\\Configuration\\WorkSpaces\\Template\\Template.cfg");
DgnWorkSetPtr workSet = DgnWorkSet::Create(*workSpace, *dgnwsmoniker, *wsCfgMoniker, WString(L"testset"), L"Description");
WCharCP vname = workSet->GetName(); //returns "Template"

IDgnWorkSetInfoPtr wsInfo = workSet->GetInfo();
WCharCP wsName = wsInfo->GetName();
wsInfo->SetName(L"newNameTest");
workSet->SetInfo(*wsInfo);
bool te = workSpace->AddWorkSet(*workSet);  //-> return false

I think I make something wrong pointing the DocumentMonikers on the Template but I don't have any better Idea.

Has anybody experience with this functions or an Idea what I'm doing wrong?

best Greetings

Manuel Höger

Diplom Physiker

Softwareentwicklung | mhoeger@cadcom.de           

cadcom Systemhaus GmbH