Newsgroups: microsoft.public.sharepoint.portalserver
From: jman0 <jm...@zapo.net>
Date: Wed, 1 Jul 2009 03:04:50 -0700 (PDT)
Local: Wed, Jul 1 2009 8:04 pm
Subject: Programmatically attach a file to a list item (c#)
I'm developing a custom webpart to substitute the standard webpart on
the NewForm.aspx and EditForm.aspx and create and edit elements on a list. The list must allow attaching files to list items, so I've programmed a way to do this, but I have a problem. If I open the site on the MOSS Server, everything runs fine and the The code which throws the exception is this: FileStream file = null; // Read the file. This appears to be the offending line // Path is a string parameter containing the local path to // Store file contents in a byte array SPAttachmentCollection AttachmentList = Item.Attachments; // Item is the SPListItem object I'm working with string FileName = GetFileName(Path); // GetFileName is a static method I made, to extract the AttachmentList.Add(FileName, Content); How does MOSS internally accomplish such a thing? I've never had to it Thanks in advance. You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
| ||||||||||||||