Alexander's Blog

Sharing knowledge with the global IT community since November 1, 2004

Error: “Method ‘Post’ of object ‘IOWSPostData’ failed” in SharePoint

/
/
ad-mania

When importing an Excel spreadsheet into a SharePoint List I ran into this error on a computer running Windows XP SP2 and Office 2003. Then I tried importing on a Windows Vista computer running Office 2007. After doing some research I found a solution on Microsoft MVP Kathy Hughes’ blog.

I am documenting the solution for Office 2007 here but the solution for Office 2003 should be similar. Just replace the references accordingly. For example, in step 2 you will replace the reference to Office 12 with Office 11.

Error

I experienced the error when I tried to import the spreadsheet. The error states:

Method ‘Post’ of object ‘IOWSPostData’ failed

excelimport61

Cause

This error is apparently due to a failed Application.SharePointVersion(URL) call in the Excel add-in which causes Excel to try and use the IOWSPostData.Post() to publish the range. This method is used by SharePoint Team Services 1.0. If you can force it to use version lookup result variable (lVER) to a later version (e.g. 2 or later), Excel will use SOAP to communicate with WSS 3.0 and you should be able to import the data successfully.

Solution

1. Open Excel 2007.

2. Open EXPTOOWS.XLA add-in which is located by default in C:\Program Files\Microsoft Office\Office12\1033 folder. If prompted, Enable the macros.

3. Press ALT+F11. You should see the Microsoft Visual Basic code editor window as shown below.

excelimport7

If you do not see the code editor window open. Go to ExptoOWS (EXPTOOWS.XLA, Forms folder and double-click publishForm. Press F7 (or View, Code from menu) to open the code editor.

4. You need to locate the lVer = Application.SharePointVersion(URL) code. Use CTRL+F to locate the code, as shown above. The letter before “Ver” is a lowercase L, not the number 1.

5. Comment out the line that says lVer = Application.SharePointVersion(URL) as follows:

lVer = Application.SharePointVersion(URL)

6. Add a line lVer =2. Your two lines should now read:

‘lVer = Application.SharePointVersion(URL)

lVer = 2

Notice the apostrophe ‘ before line one.

excelimport8

7. Save the file and exit Excel.

8. You should now be able to import Excel files into SharePoint Lists without any problems.


Copyright ©2009 Zubair Alexander. All rights reserved.

  • Facebook
  • Twitter
  • Linkedin

16 Comments

  1. Thanks for posting this solution. I’ve been fighting this exact problem for several days, and you just solved it for me!

  2. How can the solution be to open Excel 2007 when I’m using Excel 2003. I’m trying to import a file into SharePoint 2007 and when i press the import button, it just sits there, but then i close the process and it says Import Aborted. I don’t have Office 2007 available. I’m confused by your answer. Do i need to have Excel 2007 in order to do this import? And if i don’t, i’m out of luck?

    Thank you in advance for your help!
    Dasen

  3. Dasen, You don’t need Excel 2007 for importing. My solution was written for Excel 2007 but you can use Excel 2003. Just follow the same steps as for Excel 2007 but replace the references to Excel 2003 accordingly.

  4. I’m using Excel 2003 and have followed these steps exactly as described. However, I’m not finding the “lVer = Application.SharePointVersion(URL)” code that I’m searching for. Any ideas?

  5. Cristi,

    First of all make sure that you are editing the EXPTOOWS.XLA file in Office11 folder and not Office12, in case you have both versions installed. Because the line “lVer = …..” is commented out anyway, just add the “lVer = 2” (without the quotes) at that location.

  6. Hi, I am using Excel 2003. The Office12 directory does not exist on my machine. I can find this file in the Office11 directory, but it looks like the IVer = Application.SharePointVersion(URL) does not exist. I don’t know what to do. Any help is welcome.

  7. Reg,

    I’ve already mentioned in my article (step 2) that for Office 2003 you need to use Office11 folder. The “lVer = …..” is commented out anyway so you just need to add the “lVer = 2″ (without the quotes) line at that location in the file.

  8. Dansen / Cristi, I’ve found the solution for Excel 2003. Instead of trying to perform the standard “create List / Import Excel” thing and getting the error that we ALL get with 2003, try this: From Excel, select the data you want to use in the Custom List, go: Data | List | Create List. This will create the list. THEN (still in excel) go back to Data | List | Publish List. This brings up a dialogue box asking for the URL of the SharePoint site. What I did was copy and paste the URL without the .aspx file (http://mysharepointsite.com/marketing/ ’cause I wanted to put the custom list in the Marketing SubSite). Give it a name and click Next. It will show you how the fields will be created (text, numbers, dates whatever..) then click Finish.

    Good Luck.

  9. A wonderful article…. this is just what I needed to read today. Thanks for describing the way you work and how you structure your writing projects. I’ll go read that article now.

  10. Hi Alexander,

    I followed your steps and changed the code in EXPTOOWS.XLA. However, after saving and trying to import again, I get a new 1004 error “application or object defined” and then the debugger stops at the following line in EXPTOOWS.XLA “rng.QueryTable.Delete ‘ delete query table if there is one on the range”

    Any thoughts on this – many thanks.

  11. What do I do if the lVER does not even come up in the search? I’m in VB and that string does not even come up. Now what? I still get the error.

  12. Thanks lot. I was using Excel 2003 and was searching for days how to get the spreadsheet into my SharePoint site and now I got it working. Thank you so much for sharing this information.

  13. Mathi,
    I am glad you found this post useful. Microsoft Excel’s integration with SharePoint is appreciated by most people. After all, Excel is the most popular database on the planet.
    Zubair

  14. Hi, thanks for this post, helped me a lot! Little side note, works also perfectly with Office2010 and WSS3.0 SP2…

    Thanks!

  15. I cant find any EXPTOOWS.XLA in 1033 folder. I already show all the hidden file but still cant find that thing. Please help me.

Leave a Comment

Your email address will not be published. Required fields are marked *

This div height required for enabling the sticky sidebar