Tuesday, July 8, 2008

Method 'Publish' of object "ListObject failed.

I've been trying to import CSV's into a SharePoint Lists. All but one seems to be import successfully. A single CSV is giving me a lot of problems and I only get the very generic error -

Method 'Publish' of object "ListObject" failed.

My work around for this error was to attempt to Create a Custom List by selecting Import Spreadsheet. I gave the list a name, and browsed to my problematic CSV location. I selected my problematic CSV and picked the Range of Cells, and then hit Import.

The looks like it is starting and then failed with the wonderful error message "Method 'Publish' of object "ListObject failed". But it didn't truly fail. It actually will create a list with columns but no records. I navigate to my new empty list and change to Datasheet View. Do a comparision to make sure all of the column headers are correct. Also check to see if your data types are correct for each columns (single line of text, date and time, etc.). Make any adjustments as necessary.

After you're finished jump back to the CSV and select all of the data, minus the column headers (which already exist in the list), copy and paste the data into the First Cell in the First New Column that was created by the failed import. Trying to paste directly into the "Title" Column will cause completely separate issues.

Depending on the number of records you're trying to paste, this may take a few minutes. I've found pasting more than 2000 records with a list over 200 columns is pretty slow. It's also against best practice to even have a list over 2000 items, so make sure you plan accordingly.

Separately, if you have to have all of your items in a single list, which is usually dictated by your customer or your business team, keep an eye on your memory usage on your desktop/laptop you're doing your work from. The more items you copy to your clipboard and then attempt to paste into a list will drive your Internet Explorer Memory through the roof. I've had iexplorer.exe over 1.5GB on multiple occassions. Not something I'd recommend if you're working from a Laptop with 2GB of memory. Less records copied means less memory consumed by IE, but will increase your time spent copying and pasting.

This process only directly impacts your machine. I've confirmed that my desktop is practically unusable while pasting 20,000 records and no one else in SharePoint is impacted. Who says client side processing is bad?

If you don't like the status bar at the bottom of your browser when you're pasting, attempt to navigate away from the list. You'll be prompted to nagivate away and lose your changes or wait. Wait for the changes to complete and you'll get a status bar box in the middle of your window that gives a better indication of your progress.

Rinse, lather and repeat as necessary.

My impression is that Excel was using the SharePoint Web Services to upload the CSV and create a list. Something is breaking after the list is created, and the columns have been created. I don't the exact reason yet, but I'm working on that. When I have an explanation for the error, I'll update the post.

1 comment:

San said...

I'm facing the same issue, did you get any solution for this instead of copy & pasting in datasheet view