Chris
Chris

Reputation: 4471

Webs.UpdateColumns Web Service

I'm tying to change the DisplayName of the Title site column in my sharepoint site. The column was renamed and now I want to change it back to Title but you can't do it through the UI because SP whines about that column name already existing or being a reserved name. I don't have access to the server, so I can't use Power Shell or the object model to update the column. I'm trying to use the Webs.UpdateColumns web service to do my bidding, but I keep getting 0x80004005 Operation Failed errors. This is the code I'm using.

var soapEnv =
    "<soap:Envelope xmlns:soap='http://schemas.xmlsoap.org/soap/envelope/'> \
        <soap:Body> \
            <UpdateColumns xmlns='http://schemas.microsoft.com/sharepoint/soap/'> \
                <newFields><Fields /></newFields> \
                <updateFields> \
                    <Fields><Method ID='1'><Field Type='Text' Name='Title' DisplayName='Title'></Field></Method></Fields> \
                </updateFields> \
                <deleteFields><Fields /></deleteFields> \
            </UpdateColumns> \
        </soap:Body> \
    </soap:Envelope>";

$.ajax({
    url: "http://moss.local/_vti_bin/webs.asmx",
    type: "POST",
    dataType: "xml",
    data: soapEnv,
    contentType: "text/xml; charset='utf-8'",
    complete: function(xData, status) {
        console.log(status);
        console.log(xData.respnseText);
        console.dirxml(xData.responseXML);
    }
});

And this is the response I get back:

<soap:envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
    <soap:body>
        <updatecolumnsresponse xmlns="http://schemas.microsoft.com/sharepoint/soap/">
            <updatecolumnsresult>
                <results>
                    <newfields></newfields>
                    <updatefields>
                        <method ID="1">
                            <errorcode>0x80004005</errorcode>
                            <errortext>Operation Failed</errortext>
                        </method>
                    </updatefields>
                    <deletefields></deletefields>
                </results>
            </updatecolumnsresult>
        </updatecolumnsresponse>
    </soap:body>
</soap:envelope>

Any ideas one what would be causing the failed result?

Upvotes: 0

Views: 584

Answers (1)

Chris
Chris

Reputation: 4471

Well, I didn't find out why I was getting an operation failed error, but I found a solution to my underlying rename problem. Turns out SP doesn't do a server-side check for conflicting column names on FldEdit.aspx, so removing the client-side check allowed me to rename it.

I navigated to the site column page, saved it to my local disk, changed this block of code

if (doesFieldNameConflict(DisplayName))
{
    alert(L_alert3_Text);
    frm.DisplayName.focus();
    return false;
}

to this

if (doesFieldNameConflict(DisplayName))
{
    //alert(L_alert3_Text);
    //frm.DisplayName.focus();
    //return false;
}

opened the file and proceeded to change the column name like normal.

Upvotes: 1

Related Questions