Update HTML Document Item Properties using it's Element Values

Feb 19, 2014 at 4:22 AM
Edited Feb 19, 2014 at 4:23 AM
Ok, I haven't started on the code (as I don't know where to start), but what I am looking to do is take an HTML document and use values located in the document's elements (input.val(), etc) and update its item properties within Sharepoint. This will be on a MOSS farm.

I assume I will use a combo of GetListItems and UpdateListItems. I am not a JS or SP expert but I have used SPServices in the past. I was originally looking to use a workflow but I realized that wont work so I suppose a static page that just loops through all the documents. I figured I can create a 'flag' column that gets set once the function runs to prevent it looping all doc's in each run.

My apologies if this seems off the wall, but I have been looking to do this for about 2 years with no avail. Any direction would be appreciated.

Feb 19, 2014 at 11:14 AM
What you're describing sounds like Publishing Pages. Would that make more sense?

Feb 20, 2014 at 3:02 AM
It does! I wish I could take that route but the HTML pages are already written. I have a "printable" completed form (not sure of the original format, but its in an environment I don't have ajax access to) and all the elements of the form have ID's. When I upload the forms (currently done in Win Explorer view), I would like the new documents to grab the values of the various form elements and push them to the documents property columns in SharePoint.

I was hoping to avoid rendering each page to do it, but I am looking for any option. Thank you for the quick reply!
Jun 24, 2014 at 3:59 PM
Here is what I have on this. I finally felt I have learn enough to take a stab at it. Its not working because the number of items that have to load, but I am working on the looping. I have seen what has been posted but the promise stuff is out of my league. Since this script is just running form an HTML page, I am not opposed to using inputs to control block and just changing the values and rerunning it.

$(document).ready(function () {
//function loadblock () {
        operation: "GetListItems",
        async: false,
        listName: "{d3498759-c3f5-4678-8efc-29ed4217bf2f}",
        CAMLQuery: "<Query><Where><Neq><FieldRef Name='RiskScore'></FieldRef><Value Type='Integer'></Value></Neq></Where></Query>",
        CAMLViewFields: "<ViewFields><FieldRef Name='LinkFilenameNoMenu' /><FieldRef Name='ID' /></ViewFields>",
        completefunc: function (xData, Status) {       
            $(xData.responseXML).SPFilterNode("z:row").each(function () {
                var qURL = "https://appservicesstd.wss.pncbank.com/CSB/BBS/1J/Test/" + $(this).attr("ows_LinkFilenameNoMenu"); //+ ".htm";
                var qID = $(this).attr("ows_ID")
               $("#eval").load(qURL + "#divEvaluation", loadeval(qURL, qID));
function loadeval(qURL, qID) {
    return function () {
        if ($('#Section40431477_txtScore').length > 0){
            var Osc = $('#Section40431477_txtScore').html();
            var RMsc = $('#Section40431477_Category40431484_Element40431497_txtScore').html();
            var RMcom = $('#Section40431477_Category40431484_Element40431497_txtComment').html();
            var CAsc = $('#Section40431477_Category40431484_Element40431497_txtScore').html();
            var CAcom = $('#Section40431477_Category40431485_Element40431498_txtComment').html();
            var COsc = $('#Section40431477_Category40431486_Element40431499_txtScore').html();
            var COcom = $('#Section40431477_Category40431486_Element40431499_txtComment').html();
            var KEsc = $('#Section40431477_Category40431487_Element40431500_txtScore').html();
            var KEcom = $('#Section40431477_Category40431487_Element40431500_txtComment').html();
            var BAsc = $('#Section40431477_Category40431488_Element40431501_txtScore').html();
            var BAcom = $('#Section40431477_Category40431488_Element40431501_txtComment').html();
         else {
              var Osc = $('#Section41258633_txtScore').html();
            var RMsc = $('#Section41258633_Category41258641_Element41258657_txtScore').html();
            var RMcom = $('#Section41258633_Category41258641_Element41258657_txtComment').html();
            var CAsc = $('#Section41258633_Category41258642_Element41258658_txtScore').html();
            var CAcom = $('#Section41258633_Category41258642_Element41258658_txtComment').html();
            var COsc = $('#Section41258633_Category41258643_Element41258659_txtScore').html();
            var COcom = $('#Section41258633_Category41258643_Element41258659_txtComment').html();
            var KEsc = $('#Section41258633_Category41258644_Element41258660_txtScore').html();
            var KEcom = $('#Section41258633_Category41258644_Element41258660_txtComment').html();
            var BAsc = $('#Section41258633_Category41258645_Element41258661_txtScore').html();
            var BAcom = $('#Section41258633_Category41258645_Element41258661_txtComment').html();
            operation: "UpdateListItems",
            async: false,
            batchCmd: "Update",
            listName: "{d3498759-c3f5-4678-8efc-29ed4217bf2f}",
            ID: qID,
            valuepairs: [
                ["RiskScore", RMsc],
                ["RiskComments", RMcom],
                ["CustomerAdvocateScore", CAsc],
                ["CustomerAdvocateComments", CAcom],
                ["CommunicatorScore", COsc],
                ["CommunicatorComments", COcom],
                ["KnowledgeScore", KEsc],
                ["KnowledgeComments", KEcom],
                ["BrandAmbassadorScore", BAsc],
                ["BrandAmbassadorComments", BAcom]      
            completefunc: function (xData, Status) {
Jun 24, 2014 at 6:28 PM
So it looks like this is reading a bunch of fields from the .htm pages and adding them as items in a list, effectively turning the .htm pages into data. Nice!

Jun 24, 2014 at 7:30 PM
That is correct! I have this HTML form and rather than changing the code in each form, I figured I would scan the HTML and use your wonderful library to load it into the form. Thank you again for your work on not only creating the library but also for its continuous improvements.