cancel
Showing results for 
Search instead for 
Did you mean: 

Updating folder creates new object - Why?

Former Member
0 Kudos

Hi,

I'm writing some code to modify the description of a folder. Every time the folder is updated, a new object is being created. Can someone tell me why this is happening?

var infoStore = BOWrapper.InfoStore;

var query = new StringBuilder("SELECT * FROM CI_INFOOBJECTS WHERE SI_KIND='Folder' AND SI_ID=").Append(folder.Id);

InfoObjects infoObjects = infoStore.Query(query.ToString());

InfoObject infoObject = infoObjects[1];

PluginManager pluginManager = infoStore.PluginManager;

PluginInfo pluginInfo = pluginManager.GetPluginInfo("CrystalEnterprise.Folder");

infoObjects.Add(pluginInfo);

infoObject.Title = folder.Title;

infoObject.Description = folder.Description;

infoStore.Commit(infoObjects);

This also happens when I update a user. Is it something to do with the infoStore.Commit(infoObjects) statement?

Thanks

James

Accepted Solutions (1)

Accepted Solutions (1)

Adam_Stone
Active Contributor
0 Kudos

The code below is saying to add a folder object


PluginManager pluginManager = infoStore.PluginManager;
PluginInfo pluginInfo = pluginManager.GetPluginInfo("CrystalEnterprise.Folder");
infoObjects.Add(pluginInfo);

Not sure why you have that in there since you don't need this code to modify an existing object.

Former Member
0 Kudos

What code would you use to update a folder/user/group etc?

Thanks

James

Adam_Stone
Active Contributor
0 Kudos

The rest of the code that you had that I didn't quote.

former_member184995
Active Contributor
0 Kudos

Something like:

InfoObjects infoObjects = infoStore.Query(query.ToString());

InfoObject infoObject = infoObjects[1];

infoObject.Title = folder.Title;

infoObject.Description = folder.Description;

infoStore.Commit(infoObjects);

Jason

Former Member
0 Kudos

Ok, I understand now. Using the PluginManager is only for creating new objects, correct?

Thanks

James

Answers (0)