1

Maybe the Title is a little confusing, so I will to explain my problem.

I need to save different attachments in a row of my list but SharePoint does just allow me to have more than one Attachment column. As workaround I would like to create separate Document libraries and connect its items to my lists items.

I would like to add the ID of my list's item to the document I upload into the Document Library. As far as I know there is no way to fill columns automatically when creating a new item.

Is that right? Does anybody have any ideas on how to solve my problem?

2

yes it is possible! from you description as a workaround you would need to create custom code within an event reciver!

but!!!! you can do somthing better, a lookup colunm that will look like this:

lookup multiple values

I think this is more than what your looking for! less coding and only need to create a column extra that holds the IDs that are related to other list/library!

in your case the top list would contain an item, the bottom list would contain all the attachments with corresponding ID's to the first list! so in the first list the IDs are unique and the second list the IDs are many, this makes a 1 to many relationship, where one list item can have many attachments ;)

http://office.microsoft.com/en-us/sharepoint-help/create-list-relationships-by-using-unique-and-lookup-columns-HA102771358.aspx

from the link above:

How to: Create or modify a unique column

Warning You cannot create a unique column in a list with item-level permissions defined, you cannot break inheritance of permissions from a list to a list item if the list contains a unique column, you cannot create a unique column or modify a column to be unique in a list that contains items with unique permissions or one that has content approval enabled, and you cannot copy a file to a library by using the Open with Explorer command, if that library contains a unique column.

1.Navigate to the site containing the list.

2.Click the name of the list on the Quick Launch, or on the Settings menu , click View All Site Content, and then under the list section, click the name of the list.

3.Click List > Create Column.

4.In the Columns Name box, type a name for the column.

5.Under The type of information in this column is, click one of the following: Single line of text Multiple lines of text Choice Number Currency Date and Time Yes/No Lookup (single value) Person or Group (single value)

6.In the Additional Column Settings section, under Enforce unique values click Yes. If you select a data type that is not supported, or of you are creating a lookup column that allows multiple values, the Enforce unique values is not displayed.

Notes You cannot remove the index of a unique column. If you want to remove the index, you must change the column from a unique column to one that allows duplicate values first, and then remove the index.

If you try to change an existing column from duplicate values to unique values, you may be prevented from doing this operation if the existing column contains duplicate values. In this case, you must remove all the duplicate values first, and then change the column from allowing duplicate values to a unique column.

If you want to change the data type of the unique column, you must do the following: change the column to allow duplicate values, remove the index, change the column to the other supported data type, and then make the column unique.

How to: Create a lookup column

1.Navigate to the site containing the list.

2.Click the name of the list on the Quick Launch, or on the Settings menu , click View All Site Content, and then under the list section, click the name of the list.

3.Click List > Create Column.

4.In the Columns Name box, type a name for the column.

5.Under The type of information in this column is, click Lookup.

6.In the Get information from box, select a target list.

7.In the In this column box, select a primary column.

8.Under Add a column to show each of these additional fields, for each secondary column you want to add, click the check box next to the column name. Only columns with supported data types are listed.

9.Later on if you want to add or remove secondary columns, modify the lookup column and make the selections you want.

Note You cannot index a secondary column nor can you make a secondary column unique.

10.If you want the lookup columns to display in the default view, select Add to default view.

11.To create an enforced relationship, select Enforce relationship behavior and then click Restrict Delete or Cascade Delete.

12.Click OK.

How to: Create relationships in the display and edit forms

Once you create a lookup column, you can modify the display and edit forms of the target list so that related data from the source list is displayed. For example, you can edit the display or edit page for the Orders list to add the related Items list and automatically connect the two corresponding List View Web Parts together by the passing the Lookup column value.

1.In the target list (for example, Orders) click List > Modify Form Web Parts > Default Display Form or Default Edit Form.

2.In the Main Web Part Zone, click Add Web Part.

3.Click Insert > Related List, and then select the related list (for example, Items). Note Only lists for which you have View Items permission are displayed.

The two lists are automatically connected. After you save the page, when you display or edit an item from the Orders list, the related items in the Items list also display.

EDIT

for the next stage you want to update the upload.aspx, this will be slightly more work! as your customising ootb feature! so you need to do two steps!

1) redirect to your custom upload.aspx page 2) bind to list within the new upload.aspx page

for the first task follow:

you have two options for this:

Modification of '_layouts/upload.aspx'

the link above (accepted answer is easyiest in your case)

or

this is also an easy method as its already done for you:

http://spcustomupload.codeplex.com/

for the second task follow:

http://geekswithblogs.net/SoYouKnow/archive/2010/01/21/sharepoint-populating-drop-down-list-field-with-data-from-different.aspx

the link above is slightly different to what you want but the principal is the same and should be easy enough to figure out ;) you will need sharepoint designer tho! as noted you need to copy the upload.aspx page which you should of done already in step one!, open in spd (sharepoint designer) and add the control you want! in your case a drop down box, then follow the rest of tutorial ;)

  • Ok thats cool but how can I specify the right ID when uploading an attachment? I mean I could do it by hand but thats not really user friendly. It would be cool if I can select an item in the list and as long as the item is selected each file I upload would get the ID of the selected item - is that possible? – joko1206100 Aug 28 '13 at 12:39
  • just ammended my answer! – Ali Jafer Aug 28 '13 at 14:33
0

You can use event receiver on the ListItems. Whenever a new item is added to the List the event ItemAdded event receiver will fire. You can write your own business logic here as per your requirement.

0

The way I go about this is to create folders in the document library named with the ID of the list item and set a link with from the workflow to that folder URL in a hyperlink column. The user clicks the hyperlink, uploads one or more documents (without having to rename), and then returns to the list via navigation (or you could put a link on the page to go back to the list and/or list item (your call).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.