Podemos subir documentos mediante código. Pero lo que puede ser un poco más dificil de ver es cómo subir el documento y algunos metadatos adjuntos. No pasa nada, aquí teneis la solución. El truco es pasarle una tabla hash con los datos que nos interesan.
private bool _uploadDocument(string pdfFile, string txtFile)
{
try
{
//This is mandatory for avoiding an error_web.AllowUnsafeUpdates = true;
//Use the list as a folderSPFolder folder = _web.GetFolder(_DestFolder);
SPFileCollection files = folder.Files;
//Get the fileFileStream fStream = File.OpenRead(pdfFile);
HashTable MetaDataTable = new HashTable();
MetaDataTable.Add(”nom de colonne“, “valeur“);
//Set the destination url for SharePointstring url = _DestUrlPath + _DestFolder + “/” + Path.GetFileName(pdfFile);
//Add document to the list with metadata, and overwrite an existing documentwith the same name
SPFile currentFile = files.Add(url, fStream, MetaDataTable, true);
fStream.Close();
return true;
}
catch (Exception x)
{throw new Exception(x.Message);}
}
saludos,
Juan Alcalá
Suscribirse a:
Enviar comentarios (Atom)
About me
Ingeniero Superior Informático por la Universidad de Alicante
MCTS .NET Framework 2.0
MCTS Sharepoint 2007
MCTS .NET Framework 2.0
MCTS Sharepoint 2007
Links
Posts
-
▼
2008
(50)
-
►
julio
(10)
- Nueva certificación
- Project Server 2007 + SharePoint 2007
- Instalación de Project Server 2007
- Audiencias en SharePoint 2007
- Compatibilidad correo entrante (incoming email) en...
- Diferencia entre el GAC y la carpeta BIN
- MOSS User Search
- MOSS User Search (Version 2)
- Smartpart for SharePoint
- MOSS User Search (Vers. 2)
-
►
julio
(10)

0 comentarios:
Publicar un comentario en la entrada