Moving a List Item attachment from one list to another

Hi,
What are the best way of coping / moving the List Item attachment using
jQuery / JavaScript in SharePoint 2013 from one list to another.
Thanks
Saroj
Impossible is nth but good coding :-)

For your needs better try to code your own solution. See
SharePoint JavaScript Class Library for details. You can have two possible architectures:
Make all work from JavaScript. And the first your step will be
addItem method of SP.List.
Make processing of selection on client in JavaScript and call your custom server-side component (may be an application page) for items copying (creating copies in new list of already existed items from initial list.). See
this for example.
Also be careful with context.load. It's recommended to write all next code in context.executeQueryAsync. Use Firebug in FF and developer tools in Chrome for debugging your code and to find what is wrong.
Or 
https://social.msdn.microsoft.com/Forums/sharepoint/en-US/1d01a48f-c28b-467b-acd1-22e5fb266670/how-to-retrieve-list-items-and-copy-it-to-other-list-using-javascript-object-model?forum=sharepointdevelopmentprevious
<script type="text/javascript">
ExecuteOrDelayUntilScriptLoaded(retrieveListItems, "sp.js");
var siteUrl = 'Site Url';
function retrieveListItems() {
var clientContext = new SP.ClientContext(siteUrl);
var oList = clientContext.get_web().get_lists().getByTitle('List1');
var camlQuery = new SP.CamlQuery();
camlQuery.set_viewXml('<View><Query><Where><Geq><FieldRef Name=\'ID\'/>' +
'<Value Type=\'Number\'>1</Value></Geq></Where></Query><RowLimit>10</RowLimit></View>');
this.collListItem = oList.getItems(camlQuery);
clientContext.load(collListItem);
clientContext.executeQueryAsync(Function.createDelegate(this, this.onQuerySucceeded), Function.createDelegate(this, this.onQueryFailed));
function onQuerySucceeded(sender, args) {
var listItemInfo = '';
var listItemEnumerator = collListItem.getEnumerator();
while (listItemEnumerator.moveNext()) {
var objListItem = listItemEnumerator.get_current();
var clientContext = new SP.ClientContext(siteUrl);
var oList = clientContext.get_web().get_lists().getByTitle('List2');
var itemCreateInfo = new SP.ListItemCreationInformation();
this.oListItem = oList.addItem(itemCreateInfo);
oListItem.set_item('Title', objListItem.get_item('Title'));
oListItem.update();
clientContext.load(oListItem);
clientContext.executeQueryAsync(Function.createDelegate(this, this.onQuerySucceededFinal), Function.createDelegate(this, this.onQueryFailed));
function onQueryFailed(sender, args) {
alert('Request failed. ' + args.get_message() + '\n' + args.get_stackTrace());
function onQuerySucceededFinal(sender, args) {
//Do next set of operation if needed
</script><input name="btnVarIQReject" onclick="retrieveListItems()" type="button" value="Submit"/>
Please use my above POC code to start. This will copy all the title field value from list1 to list2
If this helped you resolve your issue, please mark it Answered

Similar Messages

  • How to publish infopath list form changes from one environment to another

    How can we move InfoPath customized list form changes from one environment to another example Development environment to UAT environment? We can save that as source file and update url on the .xsn file. But is there any other way we can do it?
    Rajasekar A.C

    Hi,
    You can save the list as template in source environment. Download the template for List Templates, upload in the same location in Destination site. The customized infopath should go with it. Let us know if that doesnt work.
    Regards, Kapil ***Please mark answer as Helpful or Answered after consideration***

  • Vendor Open items transfer from one Recon to Another recon

    We have wrongly maintained one recon account in Vendor. 
    Is there any way to trnasfer Vendor Open items transfer from one Recon to Another reconciliation account..

    Hi,
    The best way is to transfer the items from old to new reconciliation account.
    Please use the following entries to transfer.
    1. Dr Vendor a/c(Old recon a/c)
        Cr Vendor clearing a/c
    After nullifying the balance in old recon account, here chage recon in the master.
    2. Dr Vendor clearing a/c
        Cr Vendor a/c(New recon a/c)
    F101 only post the adjustment entry at period end and reverse the same entry in next period. So, transferring the items is the best method. If you have volume of data, then create a LSMW for this.
    Rgds
    Murali. N

  • Convert list item attachment from docx to pdf using Word Automation Services

    I have been trying to convert List Item attachments from docx to pdf using word automation services, it works in a normal document library but when I use the list attachment it throws a null reference error.
    var settings = new ConversionJobSettings();
    settings.OutputFormat = Microsoft.Office.Word.Server.Conversions.SaveFormat.PDF;
    var conversion = new ConversionJob("Word Automation Services", settings);
    conversion.UserToken = SPContext.Current.Site.UserToken;
    var wordFile = SPContext.Current.Site.RootWeb.Url + "/" + wordForm.Url;
    var pdfFile = wordFile.Replace(".docx", ".pdf");
    conversion.AddFile(wordFile, pdfFile);
    conversion.Start();
    Using reflector I was able to see my problem lies in Microsoft.Office.Word.Server.FolderIterator.cs where it uses SPFile.Item which returns NULL
    internal void CheckSingleItem(SPFile inputFile, SPFile outputFile)
    Microsoft.Office.Word.Server.Log.TraceTag(0x67337931, Microsoft.Office.Word.Server.Log.Category.ObjectModel, Microsoft.Office.Word.Server.Log.Level.Verbose, "OM: FolderIterator start a single item: source='{0}'; dest='{1}'", new object[] { inputFile.Url, outputFile.Url });
    Stopwatch stopwatch = Microsoft.Office.Word.Server.Log.StartPerfStopwatch();
    try
    this.CheckInputFile(inputFile.Item);
    this.CheckOutputFile(outputFile.Url);
    Is there any way to get around this?

    Hi Qfroth,
    According to your description, my understanding is that when you use word automation service to convert Word to PDF for list item attachment, it throws the null reference error.
    I suggest you can create an event receiver and convert the word to memory stream like below:
    private byte[] ConvertWordToPDF(SPFile spFile, SPUserToken usrToken)
    byte[] result = null;
    try
    using (Stream read = spFile.OpenBinaryStream())
    using (MemoryStream write = new MemoryStream())
    // Initialise Word Automation Service
    SyncConverter sc = new SyncConverter(WORD_AUTOMATION_SERVICE);
    sc.UserToken = usrToken;
    sc.Settings.UpdateFields = true;
    sc.Settings.OutputFormat = SaveFormat.PDF;
    // Convert to PDF
    ConversionItemInfo info = sc.Convert(read, write);
    if (info.Succeeded)
    result = write.ToArray();
    catch (Exception ex)
    // Do your error management here.
    return result;
    Here is a detailed code demo for your reference:
    Word to PDF Conversion using Word Automation Service
    Best Regards
    Zhengyu Guo
    TechNet Community Support

  • ABAP Question- line item transfer from one customer to another

    Dear SAP Guru's-
    I have a hot issue so any help would be greatly appreciate. 
    I have a customer that needs to move open A/R line items to one payer to another and without using F-30 or F-21, I recall seeing a program or t-code that gave one the ability to move the line items from one customer to another by selecting all line items or listing specific document numbers.  Does anyone know what I am talking about?
    If so, does anyone have any information that could share with me so that I can do it or any documentation to start me in the right direction?
    POINTS PROMISED

    Thank you Murali and Sunil
    These t-codes are not helpful and tideous if you have many like a 1000 line items.  In addition, you lose the history, the due date information and the document type change for invoices, etc. 
    I KNOW I saw something that moved all or selected items by document number from one customer to another.  It was called payer to payer transfer.  I cannot find any information on it.
    Any help or more input, more points awarded.
    THANKS!

  • Moving User's Home Directory from one Xserve to another

    Does anyone know the procedure for moving users (Home Directory) from one server to another?
    Is there an application that can do this?
    Xserve G5   Mac OS X (10.4.4)  

    I see your problem and I think I will soon have the same one.
    I suppose one option would be to delete out the .plist. Then when the user logs in the server should recreate it. If the user had customized it they would of course lose any information.
    You could also setup a loginhook that would just run the needed defaults write... and update them as needed. Actually I think that would be the easiest option. The only down side would be making sure every use logs in once before you remove the script.
    Hmm I guess another option would be a script that loops through all the users accounts and runs the command as the user. sudo -u usershortname defaults... But I am not sure if this would have to be done on the server it self or if it could be done through a client.
    Sorry for the rambling but I am trying to come up with an answer..

  • Moving and Copying Plug Ins from one channel to another

    According to p305 of the Logic manual, "Command dragging plug ins from one insert to another copies them along with all parameter settings" ( in the Audio Configuration window),
    However when I do this it MOVES the settings and plug ins leaving the original track bereft...
    Any explanations gratefully received
    ms

    "holding option command copies the plug in settings" p305
    This is the obvious work around ... excuse the air space

  • How to download list item attachment from display.aspx

    Im uploading documents
    to list item in list by
    using file upload control. Now I should download that file. I can able to insert documents into list item in attachment column which is predefined but am how can I download the attachments by clicking on the link in display.aspx.
    I have written this for uploadFile controller.
    SPSite site = SPContext.Current.Site;
    SPWeb web = site.OpenWeb();
    SPList list = web.Lists["list2"];
    //SPListItem itemId = list.GetItemById(5);
    int itemId=3;
    SPListItem newItem = list.GetItemById(itemId);
    byte[] contents = null;
    if (FileUpload1.PostedFile != null && FileUpload1.HasFile)
    using (Stream fileStream = FileUpload1.PostedFile.InputStream)
    contents = new byte[fileStream.Length];
    fileStream.Read(contents, 0, (int)fileStream.Length);
    fileStream.Close();
    SPAttachmentCollection attachments = newItem.Attachments;
    string fileName = Path.GetFileName(FileUpload1.PostedFile.FileName);
    attachments.Add(fileName, contents);
    newItem["CLMSAttachments"] = fileName;
    newItem.Update();
    Thanks in advance.

    Hi ,
    It is your browser that decides to download/open the file.
    If you have compatible client software for the file (word for docx) your computer will by default automatically try to open it.
    But we can force the download. You have to develop a handler/aspx page that will just handle the file download and you have to override the http header "content-disposition" to "attachment;filename=yourfilename"
    Here a sample :
    var fileName = "myfile.sql";
    var r = context.Response;
    r.AddHeader("Content-Disposition", "attachment; filename=" + fileName);
    r.ContentType = "text/plain";
    r.WriteFile(context.Server.MapPath(fileName));
    Hope that will help you
    Moudhafer

  • Dreamweaver cc 2014 : why do I get error 404 on menu list item on only one list item?

    I have a list on my menu that only the last item 2009-2014 will not function. All other links in the list work. coding is the same on all items but having been trying for days and unable to get 2009-2014 to work no matter how many times I create and recreate it.
    url: www.strangersrestbc.com  (thought I had posted this originally under DW CC 2014 but can't find my original discussion)
    thanks,
    howard

    Looks like you either...
    1. Haven't uploaded the re4.jpg image
    2. Uploaded it to the wrong location (the link says it should be in your site root)
    3. Uploaded the image with the wrong name (RE4.jpg and re4.jpg are the same on your local system, but on a server they're separate files)
    Actually, #3 is true, I found the image as RE4.jpg, but the link is to re4.jpg
    To avoid this in the future, make sure your files all use lowercase, alpha-numeric names. Avoid using spaces (use hyphens and underscores instead) and avoid special characters like #&$ all together.

  • How do I get my purchased list to go from one song to another?  It stays on the same song.  Thank you

    Howdy I get my purchased songs to move to the next song ?  It stayson the same song.  thank you.

    1.  Make sure the checkboxes for all the songs are checked.
    2.  Make sure that Repeat (the symbol at the lower left that looks like two arrows forming an oval) is turned off.

  • Session state of page item different from one region to another region

    hi,
    on one particular page I have two regions. A page item (LOV pop-up) is set in the first region. I leave this region with a button and jump back with a branch to the same page. The page item has now the selected value (as is shown by session state window). So far so good.
    The second region (SQL query type) uses this page item. However, for some reason the page item is NULL in that second region.
    Can anyone explain this behavior ?
    ron

    thanks Joel,
    I did already what you suggested. The title in region 2 is evaluated to the same value as in region 1.
    The SQL query (that actually runned with identical syntax before) is:
    select bla from blatable where bla = :P920_RU
    this generates:
    report error:
    ORA-12801: error signaled in parallel query server P000
    ORA-01741: illegal zero-length identifier
    So apperently the bind variable is evaluted to (or cached as) NULL.
    I noticed something strange in the session window. There are several page items in the application. All of them are listed in the 'Session State' region. The page item that makes problems is the only one that is also listed in the 'Page Items' region. It is even listed when I start the session window from another page. Weird.
    any other ideas ?
    Actually, how could you possibly clear session state between rendering two regions ?
    Ron

  • Move Message with Attachment from one Mailbox to another problem

    Hi,
    starting with Exchange 2013 we have following odd thing. 
    (That happens with Outlook 2010 aswell as Outlook 2013). 
    My mailbox has several other mailboxes mounted aswell. (using Full Access at ECP Settings), aswell as one separate Exchange Mailbox with own User/Password. 
    Now, when I have an Email with an attachment (like Word, .jpg, whatever), I used to move it to another mailbox by using "drag & drop". 
    The mail was moved to the mailbox without noticable changes. 
    Starting with Exchange 2013, the Mail is changed into Rich Text. That means, the attachment now appears somewhere within the message, instead as real attachment. Some attachments are also lost, and as the message was moved, the only way to recover it is
    using our external Email Archive. 
    Is this a bug, or didn't I see any option that results in this odd behaviour?
    Moving to a different folder does work as expected, but not to another mailbox.
    Thanks
    Patrick 

    Based on some research we have decided to create a workaround as all mails got converted from HTML to Rich Text when moving from User Mailbox to a PST(Archive).
    We have built an add-in for end-users to archive based on the following Outlook-VBA
    Option Explicit
    Sub MoveToFolder()
    Dim objApp As Outlook.Application
    Dim strPath As String
    Dim objNS As NameSpace
    Dim objFolder As Outlook.MAPIFolder
    Dim olCurrExplorer As Outlook.Explorer
    Dim olCurrSelection As Outlook.Selection
    Dim olCurrMailItem As MailItem
    Dim m As Integer
    'pick destination folder
    Set objApp = CreateObject("Outlook.Application")
    Set objNS = objApp.GetNamespace("MAPI")
    Set objFolder = objNS.PickFolder
    'get selected mails
    Set objNS = objApp.GetNamespace("MAPI")
    Set olCurrExplorer = objApp.ActiveExplorer
    Set olCurrSelection = olCurrExplorer.Selection
    For m = 1 To olCurrSelection.Count
    Set olCurrMailItem = olCurrSelection.item(m)
    On Error Resume Next
    olCurrMailItem.Move objFolder
    If Err.Number <> 0 Then
    With olCurrMailItem
    ' due this week flag
    .MarkAsTask olMarkThisWeek
    ' sets a specific due date
    .TaskDueDate = Now + 3
    .FlagRequest = "Call "
    .Save
    .FlagStatus = olFlagComplete
    End With
    olCurrMailItem.Move objFolder
    End If
    Next m
    End Sub
    for us it was important to have the mails still in HTML Formats as some customers are sending embedded images in the mail-body which are removed when the mail where converted to Rich Text.
    For people who doesn't care in which format an mail gets archived another workaround is to Flag the Message with an follow up action, then unflag (complete the follow up) and users are able to move the messages but still they would be converted from HTML
    to Rich Text.
    Strange enough that with a simple VBA move event the message will stay in HTML Format we are happy to found a solution and maybe someone else can use it.

  • Moving or copying a photo from one album to another

    I am new to Mac and iphoto. I imported photos from a photo card to my library. I have an Album containing some of the photos imported to my library. When I went back in later to move (or add) some photos from the main library to my album, I could not seem to drag or copy them. Any suggestions regaeding what I might be doing wrong?

    First, if you are new to iPhoto, I suggest that you take the time to look at the tutorials for iPhoto and all of the iLife applications that you are going to be using. start here
    And, be sure you understand how iPhoto works, what it does and does not do.
    Look at this thread and read the posts by Smtr and Terence Devlin for more information look here
    Now, you have imported photos into iPhoto, created an album and now you cannot add photos to it?
    Have a look at this, from iPhoto Help:
    Creating a standard photo album
    You can create standard albums to better organize your photo library, group the photos you want to burn to CD or DVD, or choose pictures for a webpage.
    To create a standard photo album:
    Choose File > New Album.
    You can also click the Add button, which looks like a plus sign, in the bottom-left corner of the iPhoto window, then choose Album from the pop-up menu.
    Type a name for your album and click Create. The album appears in your Source list.
    Click Library, then drag photos to your new album.
    You can also add a photo to an album directly from another album, a CD or DVD, or another location on your hard disk. When you add a photo to an album from another location on your hard disk, iPhoto automatically imports it into your photo library.
    You can also select the photos you want to group first, then create a standard album from them. To do this, Command-click to select all the photos you want to include in the album, then choose File > New Album From Selection and name your album.
    You can also create an album by dragging a folder of photos from the Finder into an empty part of iPhoto's Source list. iPhoto creates an album with the folder's name and imports all photos contained in the folder.
    Lastly, if you have followed all these instructions and still cannot put a photo into an album, try deleting iPhoto's preference file. It is found in YourUserName/Library/Preferences/com.apple.iphoto.plist.com. You need to close iPhoto first, locate the plist file and trash it. Don't worry, iPhoto will create another one when you open it again. Open iPhoto and see if it works ok now.
    Post back after reviewing/doing all of this, if you are still having problems.

  • Vendor line items transferred from one vendor to another vendor

    Dear SAP Guru's
    My client created one vendor called "X" under General Vendor Group by mistake, now they realized that "X" vendor should be created under Related Party Vendor Group. Now they want all line items posted to that vendor should be transferred to New Vendor created under Related Party Vendor Group,
    Can you please suggest how to go about the data migration in this case
    Regards
    Sreenivasulu

    Hi Deepa
    As you suggested we would be blocking "X" (Vendor No - 110001) old Vendor and create new vendor "X" (Vendor No - 130012) and what about transfer of line items existing in old vendor (Vendor No-110001)
    my client wants to transfer all the line items (existing) of old vendor (Vendor No - 110001) to New Vendor (Vendor No - 130012) for entire year,
    Simultaneously my client don't want to run the report by combining both vendors to know how much business has done with that particular vendor, because of that reason we need to transfer all the line items from old vendor to new vendor
    Regards
    Sreenivasulu

  • Moving the HFM Oracle Database from One Server to Another

    Our Oracle DBAs have requested that our HFM Oracle db in TEST be moved to another server. When we tried this in our DEV environment, we had major issues afterwards and some of the software needed to be re-installed. Does anyone have any recommendations on how what we need to do on the Hyperion side prior and post db move to make the transition smooth? In addition to HFM, we have Essbase, Planning, Workspace, Interactive Reporting, Financial Reporting and Web Analytics.
    Thanks.
    Terri Taylor

    If all of the database files, including the binaries, are on a SAN you might be able to...
    1. Cold backup of everything - database files and binaries.
    2. Dismount the SAN volumes from the old server.
    3. Mount the SAN volumes to the new server - using the same mount points.
    4. Start up the database on the new server.
    If the OS version/release are the same between new and old, that should be about all you need to do.
    If the OS is same but upgraded to new version/release you will want to relink the Oracle executables before starting up.

Maybe you are looking for