SharePoint

Details for “Copy List Item” Action

Want a challenge?  Do a search to try to find out how the Copy List Item action works within SharePoint Designer.  Find answers to questions like “Does it copy columns by name or by ordinal reference?” and “What column type do I need on my target list if the source column is a lookup column?”

Go ahead.  I’ll wait.

Ok, technically, I didn’t wait.  But if you did search you probably didn’t find much other than the post you’re reading right now.  If you did, please let me know.

From my experience I had an idea that the copy was done by column name, regardless of order.  But I wasn’t 100% positive.  I still haven’t found any documentation supporting it’s logic, but here have been my observations.  It indeed copies by column name, regardless of order.  If you’re bored, set up a couple lists, one a copy of the other (same column names, same column order).  For now, just use simple text fields and name each field the same from list to list.  Set up a workflow to copy from the first list to the second and run it.  You should see an exact copy come over after the workflow has complete.  Now move one of the columns.  Not within a view, but within the list itself.  Now run your workflow.  Same results…all the data copied over just fine.  Finally, rename one of the columns in the source list and run the workflow.  No dice.  The data that should be in the renamed column is not there.

Now for column types.  If your source column is a Lookup column, for instance, your target column must also be a Lookup column based on the same list.  If you set the target column as a simple text field, the data will not copy over.  Same for Choice, Person, etc.  Just make sure you’re using the same column types from the source.

If you can’t use the same list as the Lookup source, your next option is to set your target column type to text and use the Create List Item action.  The end result will be the same, but you’ll need to manually set the mappings within the action.  It also has the drawback of not automatically picking up list changes so if you add or remove a column you’ll need to open the workflow and tell it what to do.

By the way, the closest thing I found documenting each action was this post.  It’s a good overview of each action.  I didn’t do any searching in the SDK so there may be something in there, although I doubt it.

Personal

YouTube on Windows Mobile

My wife just got a new Treo running WM 5 and I’m planning on upgrading to a WM based phone soon as well.  Probably the HTC Mogul, but I’m not sure yet.  The wife is loving her phone and finding a whole new world of technical possibilities…kind of exciting since I’ve always been the tech geek around the house.  When I do upgrade, I’ll be clicking on this link to CrunchGear to set up the ability to view YouTube and Google videos on the phone.  Not sure why since I don’t watch a lot of videos, but it would be cool. 

And I’m all about cool.

SharePoint

Days Until Next Event

Scenario:  A list contains items which have a recurring date.  Anniversary, birthday, things like that.  We want to calculate how many days remain until the next occurrence of that event.

Solution:  Create a calculated column to calculate the number of days from today until the next occurrence.  But today isn’t available in a calculated column, you say?  Bah…Head on over to Mark Kruger’s blog for a quick work around to be able to use Today in a calculation.  Cool. 

Anyway, once you do that, all you need is the calculation (DOB is my column for, well, date of birth):
=DATE(IF(OR(MONTH(DOB)<MONTH(Today), AND(MONTH(DOB)=MONTH(Today), DAY(DOB)<DAY(Today))),YEAR(Today)+1,YEAR(Today)), MONTH(DOB), DAY(DOB))-Today

This Today workaround really opens some doors that were previously closed.  Thanks Mark!

SharePoint

stsadm restore Results in “No content databases are available for this operation…”

I needed to “rename” (change the URL of) a site collection today so I went in and did a backup, and then went to restore using the new URL.  When I ran the restore with the new URL, I got the following error:

No content databases are available for this operation. Create a content database, and then try the operation again. To create a content database, click Content databases” on the Application Management page, select the Web application to use, and then click “Add a content database”.

I was being too cautious.  The problem was that the GUID of the new site was the same as an existing site.  My options were to either delete the old site and then run the restore, or run the restore with the -overwrite flag.  I chose the former.