Hi There,

I'm building a batch import program for documents to Sharepoint. I've been
to TechEd A'dam 2004 and there they said for these kind of tasks you have to
use the Frontpage RPC. This seems to work, but i also have custom fields in
the document library. I can fill them using the metaInfo option. This is my
commandline:

fpsepublish putdoc "http://server/document library/document.tif"
"c:\temp\document.tif"
"Category;SW|A;Name;SW|Test;Title;SW|Testing;Description;SW|Testing 123"

The documents gets added to the library, but not all of the custom fields
are filled. I've tried several things and only the fields "Category" and
"Title" get filed. Isn't this strange? What am i doing wrong??? I really
need to get this work, so i hope you have some info!

The code of the MS example project:

public void PutDocument(string uri, string fileName, string metaInfo)
{
Uri myUri = new Uri(uri);
string webUrl, fileUrl;
UrlToWebUrl(uri, out webUrl, out fileUrl);

if (null == metaInfo)
metaInfo = "";

if (!File.Exists(fileName))
throw new Exception("Could not find file" + fileName);

string postBody = String.Format(

"method=put+document&service_name=&document=[document_name={0};meta_info=[{1
}]]&put_option=overwrite&comment=&keep_checked_out=false\n",
HttpUtility.UrlEncode(fileUrl),
metaInfo);
ASCIIEncoding encoding = new ASCIIEncoding(); MemoryStream stream = new
MemoryStream(); stream.Write(encoding.GetBytes(postBody), 0,
postBody.Length); FileStream fs = File.OpenRead(fileName); byte[] b = new
byte[4096]; while (fs.Read(b, 0, b.Length) > 0) { stream.Write(b, 0,
b.Length); }
fs.Close();
SendRequest(myUri.GetLeftPart(UriPartial.Authority) + webUrl +
"/_vti_bin/_vti_aut/author.dll", stream.GetBuffer(), stream.Length);
stream.Close();
}

Hope to hear from you guys soon!

Kind regards,
Rick Smit

Re: Metainfo Frontpage RPC putdocument by Troy

Troy
Mon Jul 05 15:51:47 CDT 2004

Hi Rick -

From a troubleshooting perspective, I recommend setting some example
metainfo via the UI on an example document and then using the
getDocsMetaInfo FrontPage RPC to see how the name/value pairs are returned.
This should help you verify if you're using the correct column name and
value formats.

- Troy Starr [MSFT]
This posting is provided "AS IS" with no warranties, and confers no rights.


"Rick Smit" <ricksmit@zonnet.nl> wrote in message
news:%23EYIr2rYEHA.1224@TK2MSFTNGP09.phx.gbl...
> Hi There,
>
> I'm building a batch import program for documents to Sharepoint. I've been
> to TechEd A'dam 2004 and there they said for these kind of tasks you have
to
> use the Frontpage RPC. This seems to work, but i also have custom fields
in
> the document library. I can fill them using the metaInfo option. This is
my
> commandline:
>
> fpsepublish putdoc "http://server/document library/document.tif"
> "c:\temp\document.tif"
> "Category;SW|A;Name;SW|Test;Title;SW|Testing;Description;SW|Testing 123"
>
> The documents gets added to the library, but not all of the custom fields
> are filled. I've tried several things and only the fields "Category" and
> "Title" get filed. Isn't this strange? What am i doing wrong??? I really
> need to get this work, so i hope you have some info!
>
> The code of the MS example project:
>
> public void PutDocument(string uri, string fileName, string metaInfo)
> {
> Uri myUri = new Uri(uri);
> string webUrl, fileUrl;
> UrlToWebUrl(uri, out webUrl, out fileUrl);
>
> if (null == metaInfo)
> metaInfo = "";
>
> if (!File.Exists(fileName))
> throw new Exception("Could not find file" + fileName);
>
> string postBody = String.Format(
>
>
"method=put+document&service_name=&document=[document_name={0};meta_info=[{1
> }]]&put_option=overwrite&comment=&keep_checked_out=false\n",
> HttpUtility.UrlEncode(fileUrl),
> metaInfo);
> ASCIIEncoding encoding = new ASCIIEncoding(); MemoryStream stream = new
> MemoryStream(); stream.Write(encoding.GetBytes(postBody), 0,
> postBody.Length); FileStream fs = File.OpenRead(fileName); byte[] b = new
> byte[4096]; while (fs.Read(b, 0, b.Length) > 0) { stream.Write(b, 0,
> b.Length); }
> fs.Close();
> SendRequest(myUri.GetLeftPart(UriPartial.Authority) + webUrl +
> "/_vti_bin/_vti_aut/author.dll", stream.GetBuffer(), stream.Length);
> stream.Close();
> }
>
> Hope to hear from you guys soon!
>
> Kind regards,
> Rick Smit