File operations using SPServices

Nov 7, 2013 at 9:49 PM
Is there anyway to replicate the file operaations like SPListItem.File.Publish() & SPListItem.File.Unpublish() using SPServices?
Coordinator
Nov 8, 2013 at 12:30 AM
I don't think so. There doesn't seem to be an asmx Web Service which would cover it.

What are you trying to accomplish?

M.
Nov 8, 2013 at 2:11 PM
I have a requirement to publish all the files inside a folder on each selection of a folder from allitems.aspx page.
OOB publishing feature from the "manage content and structure" menu supports bulk publishing of files inside a folder.

-Thanks
Nov 13, 2013 at 7:50 PM
If you're trying to manage files all within the SharePoint site (no fileservers involved), you can use "CopyIntoItemsLocal" to copy files wherever they need to be. See the docs at https://spservices.codeplex.com/wikipage?title=CopyIntoItemsLocal&referringTitle=Copy. If you need to move files, you just need to accomplish an UpdateListItems-Delete operation after the copy action.

Geoff
Nov 15, 2013 at 9:45 AM
Edited Nov 15, 2013 at 10:09 AM
-deleted-
Coordinator
Nov 16, 2013 at 1:30 PM
Edited Nov 17, 2013 at 4:08 AM
jpalo:

You deleted it, but I can see it. ;+)

I never wrapped the PublishingService, did I? Do you have a reason to use it? It doesn't address SPBreed's needs, but it could still be useful.

SPBreed: I wonder if a simple UpdateListItems call would allow you to set the status somehow?

M.
Nov 18, 2013 at 12:07 AM
Hi Marc,

From the SharePoint manager I figured out "vti_level" field holds the value of published status


Image


I tried updating the list item with new value
<script type="text/javascript">
    $(document).ready(function () {
        $().SPServices({
  operation: "UpdateListItems",
  listName: "holderItems",
  ID: 57,
  async: false,
  valuepairs: [["vti_level", "2"]],
  completefunc: function(xData, Status) {    
  }
 });
    });
</script>
Still no luck.
<ErrorCode>0x81020014</ErrorCode><ErrorText>One or more field types are not installed properly. Go to the list settings page to delete these fields.</ErrorText>
I tried even with "valuepairs: [["Level", "2"]]" SharePoint is not recognizing the value pairs.

-Karthik