Setting UserSection values programatically

How do I set and get values from the [UserSection] in the Project files programmatically?
I am using C#.NET. Is there a method or collection attached to the Project List or the ListLabel class I can use?

You can use the DOM project’s UserData property to read and write this section. See here: Introduction

I must be missing something, because when I set

Project.UserData = “Mystring”;

It throws an exception.

Or I don’t understand the String^ nomenclature. What is “String^”?

Can you give me an example of how to code this in C#?

Can you attach a log file here? That’ll show the exact error that occurs. Your code looks fine, the project needs to be opened prior to setting the UserData, of course.

PS: String^ is the C++/CLI declaration. You can switch the documentation to C# as well.

Debwin4-UserData.log4 (271.6 KB)

I didn’t have the Project Open. That’s what it was. Thanks!

1 Like