Copy Attachments of sharepoint list item to a document library using Javascript on click of a button

The requirement is as follows:
1. We have a SP list. All items in the list have mulitple attachments.
2. On click of a button, All the attachments of all items should be copied to a document library
This is to be done from client side only. No server code is acceptable. We have tried following things:
1. USing Asynch call
context = new SP.ClientContext("my site name");
         this.oWebsite = context.get_web();
         var lists = oWebsite.get_lists();
         var list = lists.getByTitle('my list name');         
         context.load(oWebsite);
         var folderPath = 'Lists/<my list name>/Attachments/' + folderId;
         var Folder = oWebsite.getFolderByServerRelativeUrl(folderPath);
         context.load(Folder);
         Files = Folder.get_files();
         context.load(Files);
         context.executeQueryAsync(Function.createDelegate(this, this.ExecuteCopyOnSuccess), Function.createDelegate(this, this.ExecuteCopyOnFailure));
function ExecuteCopyOnSuccess(sender, args) {        
         for(var p=0;p<this.Files.get_count();p++)
     var file = Files.itemAt(p);    
          var filename = file.get_name();      
          if (filename != null) {
              var newUrl = 'document library url';
              file.copyTo(newUrl, true);
              context.executeQueryAsync(null,null);
In this case, Files.get_count() throws error - The collection has not been initialized. It has not been requested or the request has not been executed. It may need to be explicitly requested.
2. Using copy.asmx service
It copies files to document library but some files are blank and are having size 0.
Thanks!

Hi,
I think you can use Document Content types or document sets -
Here are links that you can refer to
http://office.microsoft.com/en-us/windows-sharepoint-services-help/introduction-to-content-types-HA010121570.aspx
http://msdn.microsoft.com/en-us/library/office/ms472236(v=office.14).aspx
http://office.microsoft.com/en-us/sharepoint-server-help/create-and-configure-a-new-document-set-content-type-HA101782461.aspx
http://office.microsoft.com/en-us/sharepoint-server-help/introduction-to-document-sets-HA101782466.aspx?CTT=5&origin=HA101782461
Hope this helps!
MCITP: SharePoint 2010 Administrator
MCTS - MOSS 2007 Configuring, .NET 2.0
| SharePoint Architect | Evangelist |
http://www.sharepointdeveloper.in/
http://ramakrishnaraja.blogspot.com/

Similar Messages

  • Exception calling "Update" with "0" argument(s): "To add an item to a document library, use SPFileCollection.Add()"

    Hi i am trying to add a new item and update existing field value in a document library with powershell 
    but i receive below error message.
    PS C:\Users\spfarm> C:\Scripts\add.ps1
    Exception calling "Update" with "0" argument(s): "To add an item to a document
    library, use SPFileCollection.Add()"
    At C:\Scripts\add.ps1:24 char:16
    + $newItem.Update <<<< ()
        + CategoryInfo          : NotSpecified: (:) [], MethodInvocationException
        + FullyQualifiedErrorId : DotNetMethodException
    #Add SharePoint PowerShell Snapin which adds SharePoint specific cmdlets
    Add-PSSnapin Microsoft.SharePoint.PowerShell -EA SilentlyContinue
    #Variables that we are going to use for list editing
    $webURL = "http://tspmcwfe:89"
    $listName = "test"
    #Get the SPWeb object and save it to a variable
    $web = Get-SPWeb $webURL
    #Get the SPList object to retrieve the "Demo List"
    $list = $web.Lists[$listName]
    #Create a new item
    $newItem = $list.Items.Add()
    #Add properties to this list item
    $newItem["Title"] = "My second item!"
    $newItem["Info"] = "s15"
    #Update the object so it gets saved to the list
    $newItem.Update()
    $web.Dispose()
    adil

    Hi Adil,
    Document Library is different from a normal list. The document library contains files inside it. You need to update the code to add a document to the library. Then you can get hold of the List Item represented by that file and update its properties. Here
    is an example:
    $WebURL = "http://aissp2013/sites/TestSite"
    $DocLibName = "Docs" 
    $FilePath = "c:\blogs.txt" 
    # Get a variable that points to the folder 
    $Web = Get-SPWeb $WebURL 
    $List = $Web.GetFolder($DocLibName) 
    $Files = $List.Files
    # Get just the name of the file from the whole path 
    $FileName = $FilePath.Substring($FilePath.LastIndexOf("\")+1)
    # Load the file into a variable 
    $File= Get-ChildItem $FilePath
    # Upload it to SharePoint 
    $spFile = $Files.Add($DocLibName +"/" + $FileName,$File.OpenRead(),$false) 
    $item = $spFile.Item
    $item["Title"] = "New Title"
    $item.Update()
    $web.Dispose()
    Blog | SharePoint Learnings CodePlex Tools |
    Export Version History To Excel |
    Autocomplete Lookup Field

  • How to Copy list item attachment to document library in SharePoint 2010

    Hi,
    How to Create a folder ("List Item - Title Name") in Document library and copy list items Attachments to the same folder in SharePoint 2010,thanks in advance.
    Regards,
    Selvan.J
    Selvan J

    Hi,
    You should first check whether the folder exists in the library, if the folder not exists, then create it.
    I had modified the code, you can use the following code snippet to achieve it.
    private void EventCopyFileWhenItemCreatedOrUpdated(SPItemEventProperties properties)
    SPSite site = new SPSite(http://YourSiteName);
    SPWeb web = site.OpenWeb();
    SPList doclibList=properties.Web.Lists["YourLibName"];
    bool foundFolder = false;
    if (doclibList.Folders.Count>0)
    foreach (SPListItem fitem in doclibList.Folders)
    if (fitem.Title.Equals("FolderA"))
    foundFolder = true;
    break;
    if (foundFolder == false)
    SPListItem folder = doclibList.Folders.Add(doclibList.RootFolder.ServerRelativeUrl, SPFileSystemObjectType.Folder,"FolderA");
    folder.Update();
    string fUrl = doclibList.RootFolder.ServerRelativeUrl+"/FolderA";
    SPFolder myLibrary = web.GetFolder(fUrl);
    if (properties.ListTitle == "YourListName")
    SPListItem sourceItem = properties.ListItem;
    properties.Web.AllowUnsafeUpdates = true;
    //get the folder with the attachments for the source item
    SPFolder sourceItemAttachmentsFolder =
    sourceItem.Web.Folders["Lists"].SubFolders[sourceItem.ParentList.Title].SubFolders["Attachments"].SubFolders[sourceItem.ID.ToString()];
    //Loop over the attachments, and add them to the target item
    foreach (SPFile file in sourceItemAttachmentsFolder.Files)
    if (CheckFileNameExist(file.Name , properties) == false)
    byte[] binFile = file.OpenBinary();
    myLibrary.Files.Add(System.IO.Path.GetFileName(file.Url) , binFile);
    private bool CheckFileNameExist(string fileNameInFileAttach, SPItemEventProperties properties)
    bool flag = false;
    SPList myDocumentLib = properties.Web.Lists["YourLibName"];
    SPQuery spQuery = new SPQuery();
    SPListItemCollection items = myDocumentLib.GetItems(spQuery);
    foreach (SPListItem item in items)
    if (fileNameInFileAttach == item["Name"].ToString())
    flag = true;
    break;
    return flag;
    Thanks & Regards,
    Jason
    Jason Guo
    TechNet Community Support

  • Sum child list items and update parent total using javascript

    I have a SharePoint 2010 Parent/Child list setup using a lookup field to join both the lists, this is working well.
    The Parent list contains requisition requests and the child list contains related item details. Each of the related child list items has a 'Line Item Total' field. I need to aggregate the Line Item Totals in the child list and place the result in a 'Requisition
    Total' in the parent. So for any given parent record the sum of it's related child 'Line Item Totals' is reflected in the 'Requisition' total in the parent row.
    I am struggling with the JavaScript code below. I am trying to aggregate Line Item Totals for a given Requisition#? Could someone please review and advise?
    <script language="javascript" src="/Purchasing/Documents/jquery-1.8.2.js" type="text/javascript"></script>
    <script language="javascript" src="/Purchasing/Documents/jquery.SPServices-2014.01.min.js" type="text/javascript"></script>
    <script>
    $(document).ready(function()
     $('select[title=Requisition#]').children().attr('disabled',true);
     $("input[title='Old Amount']").attr("readonly","true").css('background-color','#F6F6F6');
       // Retrieve the name of the selected parent item.
       var strParent=$("select[title$='Requisition#'] :selected").text(); 
     splist li = web.lists["ReqDetails"]; // This is the child list
        spquery q = new spquery();
        q.Query= "<Where>" +
         "<And>" +
          "<Neq>" +
           "<FieldRef Name='ID'/><Value Type='Number'>0</Value>" +
          "</Neq>" +
          "<eq>" +
           "<FieldRef Name='LinkID'/><Value Type='Number'>ReqID</Value>" +
          "</eq>" +
         "<And>" +
        "</Where>" +
        "<OrderBy>" +
         "<FieldRef Name='LineItemTotal'/>" +
        "</OrderBy>"
        q.ViewFields = string.Concat("<FieldRef Name='LineItemTotal' />");
        q.ViewFieldsOnly = true; // Fetch only the data that we need
        splistitemcollection items = li.getitems(q);
        foreach(SPListItem item in items)
        sum += parseInt(item["LineItemTotal"], 10);
      alert(sum)
     </script>
    Rick Rofe

    I do something similar for a PO Header/PO Detail set of lists. I use SPServices to pull the data.
    I put this code in the child edit page - so any time any child is edited, the parent is updated. I get all children records and total them up (except for the item I'm displaying at the current time. I add that value in directly from the form itself.
    <script type="text/javascript" src="/Javascript/JQuery/JQueryMin-1.11.1.js"></script>
    <script src="/Javascript/JQuery/jquery.SPServices-2014.01.min.js"></script>
    <script>var poNumber = '';
    var poDetailID = '';
    $(document).ready(function() { var queryStringVals = $().SPServices.SPGetQueryString();
    poNumber = queryStringVals["PO"];
    poDetailID = queryStringVals["ID"];
    function PreSaveAction() {
    // update the PO header with the total of all items + shipping + adjustments
    var query = "<Query><Where><And><Eq><FieldRef Name='Title' /><Value Type='Text'>" + poNumber + "</Value></Eq><Neq><FieldRef Name='ID' /><Value Type='Counter'>" + poDetailID + "</Value></Neq></And></Where></Query>";
    var viewFields = '<ViewFields><FieldRef Name="Total" />';
    viewFields += '</ViewFields>';
    var poTotal = 0.00;
    $().SPServices({
    operation: "GetListItems",
    async: false,
    listName: "PO Details",
    webURL: "/po",
    CAMLViewFields: viewFields,
    CAMLQuery: query,
    completefunc: function (xData, Status) {
    //alert(xData.responseText);
    $(xData.responseXML).SPFilterNode('z:row').each(function() {
    if($(this).attr("ows_Total")) {
    //alert($(this).attr("ows_Total"));
    poTotal += Number(parseFloat($(this).attr("ows_Total").split(";#")[1],2).toFixed(2));
    // add in this changed line (we skipped it above)
    var qty = $('input[title="Quantity Ordered"]').val();
    var price = $('input[title="Price"]').val().replace(',','');
    var extend = Number(qty)*Number(price);
    poTotal += extend;
    //alert(poTotal);
    // update the PO Header
    $().SPServices({
    operation: "UpdateListItems",
    async: false,
    listName: "Purchase Orders",
    webURL: "/po",
    ID: poID,
    valuepairs: [["Total", poTotal]],
    completefunc: function (xData, Status) {
    //alert(xData.responseText);
    $(xData.responseXML).SPFilterNode('z:row').each(function() {
    return true;
    Robin

  • Save SharePoint list item view form as a word document

    I have a view form in SharePoint 2013, and I am trying to create a button that will export the form into a MS word document.
    So really I am trying save a SharePoint form to a word file. Is that possible?

    yes below are links for reference:
    http://www.c-sharpcorner.com/uploadfile/Roji.Joy/export-sharepoint-list-items-to-word-document/
    https://www.youtube.com/watch?v=tPFKuA8yW4E
    https://social.technet.microsoft.com/Forums/office/en-US/9e38ed97-5156-448d-af71-cf5e949535d6/how-can-i-export-sharepoint-list-item-form-view-to-word-or-pdf?forum=sharepointcustomizationprevious
    http://www.ehow.com/how_5923152_export-sharepoint-list-word-document.html
    http://sharepoint.stackexchange.com/questions/129277/save-sharepoint-list-item-view-form-as-a-word-document
    Please mark as answer if you find it useful else vote for it if it is close to answer..happy sharepointing

  • How to fetch the Attched Filname of SharePoint List Item

    Hi All,
    Is there a way to fetch name of the file attached to the sharepoint list item ? Basically what we need is the file name which user has uploaded while submitting the new item, Later the same list item will get edited with another file attachment.
    We want to compare both these file names and set a Image status value which will be a dropdown. When a new item is created Status will be 'Submitted' after editing the same list item its status should become 'Resubmitted' only if attached file name is dfferent.
    We tried in SP designer 2010, but CurrentItem:Attachments is giving option either Yes or No. and from javascript we are able to retrieve filename attched but when stored it to another list column for comparison, the filename is stored as 1 which is a boolean
    value
    Please suggest us on how this can be done.
    Thanks,
    Raghu

    Hi Raghu,
    Did you the OOB Custom List? What't the error when you follow the steps from the above aritcle?
    I have ever tested a
    case to show attachment url in the Issue Tracking list, you can check if the following code could work for you.
    <xsl:element name="SharePoint:AttachmentsField">
    <xsl:attribute name="runat">server</xsl:attribute>
    <xsl:attribute name="FieldName">Attachments</xsl:attribute>
    <xsl:attribute name="Visible">true</xsl:attribute>
    <xsl:attribute name="ControlMode">Display</xsl:attribute>
    <xsl:attribute name="ItemId">
    <xsl:value-of select="$thisNode/@ID"/>
    </xsl:attribute>
    </xsl:element>
    Thanks
    Daniel Yang
    TechNet Community Support

  • How to insert sharepoint list item attachment to sql server db programatically

    Hi,
    I need to insert sharepoint list item attachments to sql server db programatically. Could some one suggest some approach and if any one work on it please provide the code. Thanks in advance

    hi,
    you can do it using powershell. Use the below script to loop through all the items attachments inside list.
    $web = $site.RootWeb<br />
    $Lists = $Web.Lists[$ListName]
    $Library = $web.Lists[$LibName]
    foreach($listItem in $Lists.Items)
    if($listItem.Attachments.Count -gt 0)
    Write-Host "**************************************************"
    Write-Host $listItem.Attachments.Count"Attachment(s) available in the ListItem:" $listItem.Title
    Write-Host "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"
    $i=0
    foreach($attachment in $listItem.Attachments)<br />
    $i++
    Write-Host $i".Attachment Name:" $listItem.Attachments.UrlPrefix$attachment
    $file = $web.GetFile($listItem.Attachments.UrlPrefix+$attachment)
    Write-Host "Adding Files to Library:"$Library.Title
    $bytes = $file.OpenBinary()
    Write-Host "Successfully Added"<br /> Write-Host "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"
    Write-Host "**************************************************"
    And use the below script to insert into SQL.
    #Connect to DB
    $DB = “server=MyInstanceName;integrated security=sspi;database=Bob”
    $conn = new-object System.Data.SqlClient.SqlConnection($DB)
    #Build the command and parameters
    $cmd = New-Object System.Data.SQLClient.SQLCommand
    $cmd.CommandType = [System.Data.CommandType]‘StoredProcedure‘
    $cmd.Parameters.Add(“@Col1″, [System.Data.SqlDbType]‘VarBinary‘)
    $cmd.Parameters[“@Col1″].Size = -1
    $cmd.Parameters[“@Col1″].Value = $bytes
    $sql = "INSERT INTO <table> (Col1) VALUES " + $cmd.Parameters[“@Col1″]
    #Execute the command
    $conn.Open()
    $cmd.ExecuteNonQuery()
    P.S. There may be some syntax error you have to make it work but the concept is right.
    Whenever you see a reply and if you think is helpful,Vote As Helpful! And whenever you see a reply being an answer to the question of the thread, click Mark As Answer

  • Open a SharePoint List item in Modal Pop up in SP 2013 fails after you filter or sort the list

    Sorry for the long post. This has been killing me. I had this script working perfectly fine in SharePoint 2010 (online) and basically i have a source custom list (list A) with a hyperlink column and a Destination List with say title and my name.
    Source List (list A) looks like this with these 2 columns
    Title    Test Link
    A         Link 1
    B         Link 2 
    C         Link 3
    Each of these links link to the actual list item in the destination list, so for example, link 1 is/sites/2013DevSite/Lists/Destination%20List/EditForm.aspx?ID=1
    So basically i want anytime the Link are clicked that point to another list's item to open in a modal dialog and the script below worked perfectly fine in SharePoint 2010 (online)
    <script language="javascript" src="//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js" type="text/javascript"></script>
    <script language ="javascript" type="text/javascript">   
    jQuery(document).ready(function() {
    jQuery('a[href*="EditForm.aspx"]').each(function (i, e) {
    // Store the A tag's current href in a variable
    var currentHref = jQuery(e).attr('href');
    jQuery(e).attr({
    'href': 'javascript:void(0);', 
    // Use the stored href as argument for the ShowInModal functions parameter.
    'onclick': 'ShowInModal("' + currentHref + '");'
    function ShowInModal(href) {
    SP.UI.ModalDialog.showModalDialog({title: "Edit Item", url: href});    
    </script>
    All it does is find the href tags for that particular value Editform.aspx and the pop modal works in SP 2010 online. So the site page is designed in such a way there is a content editor web part with the reference to this javascript file and the sharepoint
    list is right beneath it and this worked perfectly opening in modal windows in SP 2010.
    Since migration to 2013, this is what exactly happens
    1.) when you come to the site page, the modal works,
    2.) If you filter or sort on say the Title or Test Link column in Source list (lets say you select the Value A), the script does not fire at all, if i hover over the hyperlink, the who hyperlink is shown and does not open the hyperlink in the modal pop up.
    - This is important because i want to be able to sort on a particular item...
    Could someone please let me know what am i doing wrong and why is this not working when i sort the list. Thanks for all the help.
    Once again i am trying to open a sharepoint list item in Sharepoint 2013 from another list using Jquery

    A ListItem has its own unique row id so in all likelihood, an insert with the same data will result in a new list entry. The Lists Web Service however, has an UpdateListItem method which will take an update request. [refer
    http://msdn.microsoft.com/en-us/library/office/websvclists.lists.updatelistitems(v=office.15).aspx ]
    There is another note in the conference (marked answered) to your List Item Update problem. Probably worth a try too. [refer
    http://social.msdn.microsoft.com/Forums/en-US/bee8f6c6-3259-4764-bafa-6689f5fd6ec9/how-to-update-an-existing-item-in-a-sharepoint-list-using-the-wss-adapter-for-biztalk?forum=biztalkgeneral ]
    Regards.

  • Report workload by calculating how many versions of SharePoint list items created in a certain time period

    I have a total of 66 SharePoint 2010 lists - yes, 66! - each lists contains between 1500 and 3200 list items.  My employees update these various list items throughout their workday.  Each update to a list item creates a new version of the list
    item.  On average each list item will have anywhere from 5 to 10 versions before it is done.  I need to create a report that tells me how many list items they've updated in a certain time frame.  I have come close but still cannot arrive at
    the data I'm looking for. 
    This is what I have so far:
    I've created a report using SQL Report Builder 2008 v3 where I've filtered it to show only items MODIFIED between, for example, Feb1 and Feb28.  Of those records, I want the report to tell me how many versions were created during that time
    frame.  The result is one list item with 5 total versions.  Versions 1.0, 2.0, & 3.0 were created on 12/12/14.  The last two versions, 4.0 and 5.0, were created on 2/24/15.  Therefore, the answer I'm looking for is 2 because they
    created 2 versions between Feb1 and Feb28.
    However I get the following results using these queries:
    If I do a =Sum(Fields!owshiddenversion.Value) in the expression field I get the total versions which is 5
    If I do a =Count(Fields!owshiddenversion.Value) in the expression field I get the instance which is 1
    Is there a way to count ONLY the number of versions created in a time period?  Is there another hidden field in SharePoint that I can use in the expression that will give me results I'm looking for?

    Hi Rafael70,
    Per my understanding that you have already get all the need fields and informaiton of the updated version of list items and now you want to calculate how many versions of SharePoint list items created in a certain time period, you can't get desired result
    using sum and count function, right?
    I have tried to tested on my local environment but because I am not clear what is value in the field "owshiddenversion", I assumed you have two datatype parameters (StartDate and EndDate) to help filter the report in a certain time period.
    Generally, if you have add the filter correctly, it will filter the correct number's updated version in this time period, I would like you to provide details information as below to help better analysis the requirements:
    Could you please provide sample data of the table.
    Please provide snapshot of the report structure you have currently designed.
    Please try to provide all the expression you have used.
    If you still have any problem, please feel free to ask.
    Regards,
    Vicky Liu
    Vicky Liu
    TechNet Community Support

  • Uploading multiple documents into sharepoint list item with REST in sharepoint 2013 using content editor web part :

    hi ,
    i am trying to upload multiple document files into sharepoint list item. I followed below link for implementaion.
    http://techfindings-prem.blogspot.in/search/label/jquery.multifilejs
    It was working for sharepoint hosted app.
     This complete code is written within content edito web part.
    It was working when i was in root site collection with below change (hard coded the root level url) in code in "UploadFile" function.
    var scriptbase = "http://servername" + "/_layouts/15/";
                console.log(' File size:' + bytes.length);
                $.getScript(scriptbase + "SP.RequestExecutor.js", function () {
                    var createitem = new SP.RequestExecutor("http://servername");
                    createitem.executeAsync({
                        url: "http://servername/sites/cpg/" + "/_api/web/lists/GetByTitle('SalesRecord')/items(" + attachmentitemid + ")/AttachmentFiles/add(FileName='"
    + fileName + "')",
                        method: "POST",
                        binaryStringRequestBody: true,
                        body: binary,
                        success: fsucc,
                        error: ferr,
                        state: "Update"
                    function fsucc(data) {
                        //alert( data.statusText + "\n\n" + data.responseText);
                        console.log(data + ' uploaded successfully');
                        deferred.resolve(data);
                    function ferr(data) {
                        //alert( data.statusText + "\n\n" + data.responseText);
                        console.log(fileName + "not uploaded error");
                        deferred.reject(data);
    But the issue came in picture when i was working with the other site collection instead of root one. The url was like below.
    "http://servername/sites/cpg/". This time i need to be there within "cpg" site collection. 
    Now if i hard code the url as i did above my code gets break here while come to below line
     $.getScript(scriptbase + "SP.RequestExecutor.js", function () {
    I am getting error when i used below code:
    var scriptbase = "http://servername" + "/_layouts/15/";
     $.getScript(scriptbase + "SP.RequestExecutor.js", function () {
                    var createitem = new SP.RequestExecutor("http://servername");
                    createitem.executeAsync({
                        url: "http://servername/sites/cpg/" + "/_api/web/lists/GetByTitle('SalesRecord')/items(" + attachmentitemid + ")/AttachmentFiles/add(FileName='"
    + fileName + "')",
                        method: "POST",
                        binaryStringRequestBody: true,
                        body: binary,
                        success: fsucc,
                        error: ferr,
                        state: "Update"
                    function fsucc(data) {
                        //alert( data.statusText + "\n\n" + data.responseText);
                        console.log(data + ' uploaded successfully');
                        deferred.resolve(data);
                    function ferr(data) {
                        //alert( data.statusText + "\n\n" + data.responseText);
                        console.log(fileName + "not uploaded error");
                        deferred.reject(data);
    Please hekp in this case. This complete code is written within content edito web part. 
    Regards:
    Sanjay Joshi

    Hi,
    According to your post, my understanding is that you have an issue about upload multiple documents files into library vai REST API.
    As you have said, you have used the hard code url in your code.
    How about use the _spPageContextInfo.webAbsoluteUrl method to get the url?
    I have used this method to get the url, then use the code in the article you have pasted within a content editor web part to upload the files.
    You can replace the hard code url with the _spPageContextInfo.webAbsoluteUrl method, then check whether it works.
    Thanks,
    Jason
    Jason Guo
    TechNet Community Support

  • Filter SharePoint list items using CAML query as same as Like operator in SQL Server.

    Hi ,
    I have filtered SharePoint list items based on Name using CAML query <Contains> . Now I have a new requirement is to filter list items using Like operator in SQL. But Like operator is not in CAML.
    How do I filter list items using CAML as same as Like operator in SQL.
    Please let me know.
    Thanks in Advance.

    Did you try using <Contains>?
    http://social.technet.microsoft.com/Forums/sharepoint/en-US/15766fd5-50d5-4884-82a1-29a1d5e38610/caml-query-like-operator?forum=sharepointdevelopmentlegacy
    --Cheers

  • Link to Sharepoint List Item

    I have a report that I built in SQL Report Builder 3.0 that pulls data from a SharePoint 2013 list. The fields are data, location, cost, department, and reference. The reference field is number that is input by the user on the SharePoint 2013 list. Is
    there a way for the reference field in the report to be a direct link back to open the SharePoint list item when it is clicked in the report?

    Hi,
    According to the description, I know you want to redirect to the SharePoint site by clicking on the value in the reference field in your report. Take the steps below to achieve this:
    1. Right-click reference field > Text box Properties in the designer surface.
    2. Click on Action page, check the option of Go to URL.
    3. In the Select URL box, type the URL of your SharePoint list.
    e.g. http://TestServer/toplevelsite/subsite/Lists/<Listname>/AllItems.aspx
    4. Click ok. Save and upload the report.
    This URL redirects to the SharePoint list page. If you want to redirect to the display form page of an item,
     use the code like:
    ="javascript:void(window.open('http://servername/sites/xx/Lists/listname/DispForm.aspx?ID=" & Fields!ID.Value & "&Title= "& Fields!Title.Value &"'))"
    ID and Title are used to identify the item which redirect to. You can change it according to the columns.                                                                                                                                                                                          
    Thanks.
    Tracy Cai
    TechNet Community Support

  • CAML Query to Sort SharePoint list items based on Modified date

    hi ,
    can we sort sharePoint list items based on 'Modified' column, the sorting should be done up to milliseconds level.
    currently i am using CAML query as below
    <OrderBy><FieldRef Name='Modified' Type='DateTime' IncludeTimeValue='TRUE' Ascending='False'/></OrderBy>but its not considering milliseconds while sorting.
    Thanks and Regards,
    venkatesh.

    Veda, thanks but I'm not really a hardcore C# coder.
    We found more elegant solution was to create a List View which returns all records that should be deleted, based on our own custom deletion criteria, and then create an very simple SSIS Package in Visual Studio using the
    Sharepoint Connectors for SSIS to delete all Sharepoint List Items returned from that List View. The Sharepoint Destination Connector has a delete operation.
    This worked for us and didn't require any coding.

  • Retrieving Sharepoint List Item Information for SAP Best Approach

    Hi
    We have a request for retrieving Sharepoint list item information to create DVS objects in SAP. Has anybody been doing something like that, getting information out of Sharepoint into SAP? What would the best approach for this be, as usually implementations are the other way around, i.e. getting data out of SAP into Sharepoint. I think that Duet Enterprise would be an overkill for this and also requires additional licenses.
    So I have been thinking using either a PI/Web Service using the Sharepoint WSDL to retrieve the information, or maybe there are also possibilities using WebDAV. There are some CL_HTTP_WEBDAV classes, but I am not sure whether and how they could be used for this.
    Does anybody have how-tos or examples for either approach? Feedback is much appreciated.
    Thanks,
    Daniel

    Without using a ridiculously long workflow (which even then may not work) I do not think this is feasible in a sharepoint list. A workflow can be used to alter other fields in an item but not incrementing items like you require. You would be better changing
    to data sheet view (quick edit in 2013) and changing them all manually then, or changing to terms such as priority high, low etc. Overall, no this is not really possible.
    Brendan Lee

  • List items archival with version history using powershell

    HI
    Is there any way to work with site and content structure in SharePoint 2010 with power-shell.
    I want to run a automated task(power shell script) to move list items from source to destination in the same site with version history.
    I know i can do it from site and content organizer but i have to do manually and SharePoint designer workflows doesn't retain the version history.
    Please give me  your valuable tips.

    Hi Manikanta,
    Archive ListItem with Version History in SharePoint, I suggesting you the best links for your solution here
    http://techno-sharepoint.blogspot.sg/2012/10/moving-sharepoint-list-items-to-archive.html
    http://get-spscripts.com/2011/10/copy-sharepoint-lists-and-document.html
    For more details, reach us at
    <a href="http://staygreenacademy.com/sharepoint-2013-training/">SharePoint 2013 Online Training</a>

Maybe you are looking for