Copiar attach de lista a lista

07/04/2008 - 10:02 por joan | Informe spam
Buenas a todos,

estoy intentando copiar un item de una lista a otra desde código.
Todo perfecto, excepto cuando un item contiene un archivo adjunto.

Para intentar copiarlo hago lo siguiente:
//...el item ya lo recojo anteriormente
SPAttachmentCollection attachs = item.Attachments;

//Por si hay más de 1 archivo adjunto.
for(int i=0;i<attachs.Count;i++)
{
string nombre = attachs[i].ToString();

string url = attachs.UrlPrefix + nombre;
FileStream miStream = File.OpenRead(url);//Aquí es donde da el error.
byte[] miContenido = new byte[miStream.Length];
miStream.Read(miContenido, 0, (int)miStream.Length);
miStream.Close();
miStream.Dispose();

SPAttachmentCollection miArchivoAgregado = newItem.Attachments;
miArchivoAgregado.Add(nombre, miContenido);
}


Pero me da el siguiente error:
URI formats are not supported


Alguna sugerencia ??

Muchas gracias a todos y saludos.

Preguntas similare

Leer las respuestas

#1 joan
07/04/2008 - 10:52 | Informe spam
Hola Gustavo,

la URL que le paso al File.OpenRead es la siguiente:

http://intranet/Lists/Noticias/Atta...s/10/sp.tx


Un saludo y gracias por tu ayuda.






"Gustavo" wrote:

Mostrar la cita
Ads by Google
Search Busqueda sugerida