Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Setting Category When Publishing A Document To Sharepoint

Status
Not open for further replies.

f0z

Programmer
Jan 10, 2003
48
US
I'm sure that I'm just looking at this so long that I'm staring right at the answer but I just cant see it.

I just need to specify which category a document will belong to.

The VB.Net Code is as follows:
Code:
KnowDoc.Categories = Array(":Vehicles")

But I just cant get the damn thing to work with c#

I've tried this:
Code:
KnowDoc.Categories = new string[] {@":IT"};
but get an invalid index error.

Any Help is much appreciated cheers, foz.

 
are you sure you get the error on this line?
what type is Categories? string[]?

--------------------------
"two wrongs don't make a right, but three lefts do" - the unknown sage
 
I'm 100% the error is with this line. When I comment out this line and just publish the document without a category everything goes fine.

categories is supposed to be a string array as far as i'm aware. Granted I'm no expert with this thing so I could be wrong I can only go on the examples I've found on the internet.

the vbscript for this seems to suggest that it's an string array
Code:
oDoc.Categories = array(":products:sharepoint", ":teams:collaboration")
 
when you type in Visual Studio .NET KnowDoc.Categories a text (tooltip like) appears and says what's the type of the variable

--------------------------
"two wrongs don't make a right, but three lefts do" - the unknown sage
 
OK i've got it working

It didnt like string arrays it needed an object array, bit odd but it worked.

KnowDoc.Categories = new object[] {":Category"};

cheers, for your efforts mate
 
=] i had a hunch it might be an array of objects

--------------------------
"two wrongs don't make a right, but three lefts do" - the unknown sage
 
I never even thought of bringing up a level of abstraction to the object was just focusing on why the damn string array wouldnt work. :D
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top