AnsweredAssumed Answered

How to create NamedValue in .NET 2003 / .NET 2005

Question asked by kannank on Mar 30, 2006
Latest reply on Jun 14, 2006 by manfung78
Hi,

Thanks for your earlier answers.I am trying to upload an image file from local computer to alfresco server.I have referred the following URL from your forum as reference,
http://forums.alfresco.com/viewtopic.php?t=880&highlight=contentwebservice+write

I am currently working in .NET 2003 and .NET 2005 with C# - I need two clarification in the above URL post.

1.How to create NamedValue in .Net 2003/2005 - I guess the above URL is in java and when I try to create NamedValue in .NET it looks different (No overloading available in dotnet for NamedValue) - So please tell me how to the create NamedValue property in .NET?

2.CMLCreate in .NET also looks different than java - The following is the code snippet with "build sucess",

NamedValue[] properties = new NamedValue[] { new NamedValue() };
properties[0].name          = "test.txt";
properties[0].value         = "{http://www.alfresco.org/model/content/1.0}name";
                          
Alfresco.RepositoryWebService.ParentReference parent    = new Alfresco.RepositoryWebService.ParentReference();
parent.store          = reference.store;
parent.uuid           = reference.uuid;    
         
CMLCreate create  = new CMLCreate()
create.id               = "1";
create.parent        = parent;
create.property     = properties;
create.type            = "{http://www.alfresco.org/model/content/1.0}content";

CML cml             = new CML();
cml.create          = new CMLCreate[1] {(create)};
                           
UpdateResult[] result          = repoService.update(cml);
Reference newcontentnode = result[0].destination;

Is that correct?What is the correct "properties[0].value" to be used?When I build this code, it says sucessfully builded and when I tried to execute this code this throws error at "repoService.update(cml)" - The error is thrown at invoke method (in reference.cs page),

public UpdateResult[] update(CML statements) {
object[] results = this.Invoke("update", new object[]{statements});
return ((UpdateResult[])(results[0]));
                                                                    }

I am not sure what is the problem - Can you please give some clue to overcome this.

Your early message is much appreciated,

Looking for your message,

Thanks,
K.Kannan.

Outcomes