How to add new Release to folder? (C#, HP ALM11)
I am trying to add new release to release folder according to HP help:
[ QUOTE ]
Public Function AddItem( _
ByVal ItemData As Variant _
) As Object
ItemData - Pass either NULL or the parent folder ID.
Passing NULL as the ItemData argument creates a virtual object, one that does not appear in the project database. After creating the item, use the relevant object properties to fill the object, then use the Post method to save the object in the database.
This is the recommended technique for creating most objects that will be saved in the database. Exceptions are noted where appropriate in the specific factory object descriptions.
You can also pass an ItemData argument identifying the item to be added. When this syntax is used, no check is performed on whether all required fields have been initialized. This is safe when the item is never going to be added to the database, as in populating a list for display.
[/ QUOTE ]
I use this code:
<font class="small">Code:</font><hr /><pre>
ReleaseFactory relFactory = (ReleaseFactory)ProjectReleaseFolder.ReleaseFactor y;
Release rel = (Release)relFactory.AddItem(null);
rel.Name = sFolder;
rel.StartDate = DateTime.Now;
rel.EndDate = DateTime.Now.AddDays(30);
When I pass null as parameter I get error: "Value does not fall within the expected range."
but when I try to use parent folder id insted of NULL, I get this error: "Exception from HRESULT: 0x800403EA"
Thanks in advance for any help!
Re: How to add new Release to folder? (C#, HP ALM11)
Did you try searching for other C# related forum posts? I'm sure this one has been answered many times before.
Try passing DBNull.Value instead of Null