Welcome Serena Central users! CLICK HERE
The migration of the Serena Central community is currently underway. Be sure to read THIS MESSAGE to get your new login set up to access your account.
haqattaqq
New Member.
164 views

how to update a user defined property (DateTimeProperty)

Hi,

I've got a user defined property (a DateTimeProperty) and want to update it. How would I do that?

 

Here's the code I have for retrieving it (GetStarTeamCR is a function I wrote to find the CR):

StarTeam.ChangeRequest cr = GetStarTeamCR(crNum, view.RootFolder, server);
StarTeam.PropertyCollection crp = server.Types.CHANGE_REQUEST.Properties;
StarTeam.Property stPrpTargetDate = crp.Find("Usr_TargetDate");
string targetDateAsString = Convert.ToString(cr.GetDisplayValue(stPrpTargetDate));

...how do I update the property and save that back to starteam?

Thanks!

0 Likes
1 Reply
Micro Focus Expert
Micro Focus Expert

Re: how to update a user defined property (DateTimeProperty)

StarTeam.ChangeRequest cr = GetStarTeamCR(crNum, view.RootFolder, server);
StarTeam.PropertyCollection crp = server.Types.CHANGE_REQUEST.Properties;
StarTeam.Property stPrpTargetDate = crp.Find("Usr_TargetDate");

 

cr.SetValue(stPrpTargetDate, new System.DateTime(2019, 5, 15, 12, 35, 52);

cr.Update();

 

0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.