I'd like to be able to import a spreadsheet from Excel into SharePoint and be able to select a list template I've already built. Is this possible? I need to be able to do this so the proper workflows are attached automatically to the list. I'll need to create a new list because I'll be getting a different spreadsheet for every order.
3 Answers
Associate your workflow with a content type.
Extend Mike's suggestion by creating a new list instance which will already have the content type associated with it. As your workflow is associated to the content type you will have the workflow available in the list.
-
This is exactly how I envisioned it working. When I call the web service, I need to supply a TemplateID. How can I register that Template, so i can use that template during the web service call? Using Mike's link, I can create an Announcements list by supplying: 104 What number would I use for my custom Template? Commented Dec 3, 2010 at 18:29
-
Go to create an instance of your list manually from Site Settings -> Create... You'll see the ListTemplate= in the querystring for the link of your list template. Use that hard coded into your code to create an instance of list with that ID. If you created your List Template in declaratively through a Feature, you can manually define the TemplateID in the XML. Commented Dec 3, 2010 at 18:43
-
I just checked the templateID from the Query String and it's based on the original template I used to build the list. So in my case, I started with a custom list, modified my list accordingly and attached the workflows. When going to create a new list from this template, the templateID is 100. The same as a custom list. I'm a bit lost as to where to go from here. How can I take a list template and register it? Commented Dec 5, 2010 at 20:38
-
Ah, in that case the template ID is defined when you declaratively (or programmatically) create the list via XML. Are you able to create & deploy a feature which creates your list template? Commented Dec 6, 2010 at 8:51
-
1Creating a Feature which deploys a list template isn't terribly difficult - here's a good run-through: andrewconnell.com/blog/archive/2009/02/08/… - again, use the 12-hive folder hierarchy in your project and WSPBuilder should make the packaging/deploying a lot simpler. Commented Dec 6, 2010 at 14:37
I'm assuming you're looking for a reusable method that's got some automation.
I'd imagine you could use an Excel macro to call the lists web service, prompt the user to select a template, create that list, then push the data into the list.
You may need to store the list structure CAML in the macro vs. in a template file, as I'm not positive if lists created from a template will inherit workflow (I've never tried that).
http://msdn.microsoft.com/en-us/library/lists.lists.addlist(v=office.12).aspx
-
Yes, this does get me closer to what I was thinking. I have the Publish to SharePoint .xlam from Microsoft. I'm thinking I'm going to have to extend this macro to fire up the web services and create this template. However, from your link, I have to denote a number representing the template. If I create my own, I'm not able to call upon that template programatically. How can I add that as a list I can auto-create? Commented Nov 30, 2010 at 21:50
Create your list using your template and make sure the columns match the excel doc. Then open the list in the datasheet view and copy and paste the cells from excel into the datasheet view.
-
That's not going to be a valid solution considering I have workflows that need to fire upon item creation. Think of the problematic issues I would encounter if a copy and paste operation failed. This wouldn't be a viable solution for this. Commented Nov 30, 2010 at 21:44
-
Maybe I just don't understand what you are talking about. You want a list created, with data from excel already in it, and then have the item creation / updates workflow added? Commented Nov 30, 2010 at 22:30
-
I'd like to have a table of data in excel imported into SharePoint, not as a custom list, but using a List Template that I've already built. Commented Nov 30, 2010 at 23:24
-
Ok, based on that then I stick by my response. I think you have a timing issue here though. You want the data in the list but only before your workflows are attached but your workflows are attached when you create the list from your template and you can't add data to a list that doesn't exist yet. I think your best bet is to write some custom code that allows you to add your excel data and then attach the workflows. Commented Dec 1, 2010 at 0:19
-
Not exactly, I'd like for the data to be in the list, but I need the workflows to run for each item that is added from the import. So, I need to have a List Template w/ Workflows attached to it via content type that fire for every item. I agree w/ creating custom code but not datasheet mode for the reasons I've said above. I'm not sure how to register my List Template though. Do you know how? Commented Dec 1, 2010 at 2:39