I'm trying to create a lookup column on an Office 365 SharePoint dev site through an app using SPServices but I'm not having any luck.
function createLookupColumn(listGuid) {
//alert($().SPServices.SPGetCurrentSite());
var newField = '<Fields><Method ID="2"><Field type="Lookup" DisplayName="Marketing Plan" Required="FALSE" EnforceUniqueValues="FALSE" List="{'+listGuid+'}" ShowField="Title" UnlimitedLengthInDocumentLibrary="FALSE" Indexed="TRUE" RelationshipDeleteBehavior="Cascade" StaticName="Marketing_x0020_Plan" Name="Marketing_x0200_Plan" ColName="int1" RowOrdinal="0"/></Method></Fields>';
//var newField = "<Fields><Method ID='1' Cmd='New'><Field Type='Text' DateOnly='TRUE' DisplayName='TESTText' FromBaseType='TRUE'/></Method></Fields>";
$().SPServices({
operation: "UpdateList",
listName: "TestList",
listProperties: "",
updateFields: "",
newFields: newField,
deleteFields: "",
listVersion: "",
async: false,
completefunc: function (xData, Status) {
alert("Finished");
}
});
}
The SPServices library is loading b/c the commented out alert fires when uncommented. My listGuid arg isn't the problem either b/c I've tried uploading a basic xml file withouth overwriting the GUID (as noted in the second newField that's commented out) and that doesn't go through either. It's not failing, but it's just not creating any columns.
I've had similar problems as this in the O365 environment utilizing the get_XmlSchema and set_XmlSchema. In fact, I've never been able to set an XML on O365 and am really starting to wonder if it's even possible to overwrite XML in the cloud. What am I missing?