How to get List Item attachments name without write any custom code or any database query?

Hi,
How to get List Items attachments name without write any custom code or any database query?

You can get it from Rest,
There are 2 options,
1) create a 'Result Source' which has a search query for that List which has attachments 
 - Use rest query to get the 'Filename' , it will have the attachment file name 
For example, if the result source id is : 73e6b573-abf8-4407-9e5f-8a85a4a95159 , then the query will be 
http://[site URL]/_api/search/query?querytext='*'&selectproperties='Title,Path,FileExtension,SecondaryFileExtension,Filename'&sourceid='73e6b573-abf8-4407-9e5f-8a85a4a95159'&startrow=0&rowLimit=100
You can refine the query, be giving proper 'querytext'
2) Use the List rest api
For example if your list guid is :38d524a1-e95c-439f-befd-9ede6ecd242e
You can get he attachments for 1st item using this 
http://[Site URL]/_api/lists(guid'38d524a1-e95c-439f-befd-9ede6ecd242e')/items(1)/AttachmentFiles
get2pallav
Please click "Propose As Answer" if this post solves your problem or "Vote As Helpful" if this post has been useful to you.

Similar Messages

  • How to get list of file names from a directory?

    How to get list of file names from a directory?
    Please help

    In addition, this:
    String filename = files;Should be this:
    String filename = files;
    That's just because he didn't use the "code" tags, so [ i ] made everything following it become italicized.                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

  • SharePoint 2013 Rest Api - How to get List Items

     
    Can anyone let me know why the below method fails? I am not getting where i am making mistake. Please help
    function getListItems(term) {
                var caml = "<View><Query><Where><BeginsWith><FieldRef Name=Title/><Value Type='Text'>" + term + "</Value></BeginsWith></Where></Query></View>";
                var requestData = { "query": { "__metadata": { "type": "SP.CamlQuery" }, "ViewXml": caml } };
                $.ajax({
                    url: _spPageContextInfo.webAbsoluteUrl + "/_api/Web/Lists/getbytitle('SampleList')/Getitems",
                    method: "POST",
                    data:requestData,
                    headers: {
                        "accept": "application/json; odata=verbose",
                        "content-type": "application/json; odata=verbose"
                    success: function (data) {
                        $("#countItem").html("Pass");
                    error: function (data) {
                        $("#countItem").html("Fail");
    Below is the responseText (log)
    "{\"error\":{\"code\":\"-1, Microsoft.SharePoint.Client.ClientServiceException\",\"message\":{\"lang\":\"en-US\",\"value\":\"The HTTP method \'GET\' cannot be used to access
    the resource \'GetItems\'. The operation type of the resource is specified as \'Default\'. Please use correct HTTP method to invoke the resource.\"}}}"
    Navaneeth

    Finally executed successfully using below code. The learning is we need to use  type:"POST" instead of method:"POST"
     function getListItems(term) {
                var urltest = _spPageContextInfo.webAbsoluteUrl + "/_api/Web/lists/getByTitle('SampleList')/getitems(<Query><Where><BeginsWith><FieldRef">query=@v1)?@v1={\"ViewXml\":\"<View><Query><Where><BeginsWith><FieldRef
    Name='Title'/><Value Type='Text'>" + term + "</Value></BeginsWith></Where></Query><RowLimit>1</RowLimit></View>\"}";
                $.ajax({
                    url: urltest,
                    type: "POST",
                    headers: {
                        "X-RequestDigest": $("#__REQUESTDIGEST").val(),
                        "Accept": "application/json; odata=verbose",
                        "Content-Type": "application/json; odata=verbose"
                    contentType: 'application/json',
                    success: function (data) {
                        if (data.d.results.length != 1) {
                            $("#countItem").html("Pass");
                            $("#" + term).parent().parent().prop('disabled', true);
                            $("#" + term).removeAttr("onclick");
                            $("#" + term).css('cursor', 'default');
                            $("#" + term).parent().unbind("mouseenter mouseleave");
                    error: function (data) {
                        $("#countItem").html(urltest);
    Navaneeth

  • How to get list item from LongListSelector

    I have a list item in LongListSelector like this:
    Now when i tap on the app button so I will have the list of item in the LongList where check box value is true
    Any help or advice ?

    Add a property to the class the long list selector is bound to for the checkbox.  Loop through the items in the data source and use the new property to tell what is checked

  • How to Get List Item in Custom Context Menu?

    Hi,
    I got this code from the net.
    <CustomAction Id="SPTest.CustomMenuItem.ButtonClicked"
    RegistrationType="ContentType"
    RegistrationId="0x0101"
    Location="EditControlBlock"
    ImageUrl="/_layouts/IMAGES/DOCLINK.GIF"
    Sequence="600"
    Title="Click Me!"
    Description="Shows an alert message for this content type."
    >
    <UrlAction Url="javascript:alert('Hello World!');" />
    </CustomAction>
    It creates a custom context menu. How can i get the selected item using that code..
    Sorry for the tons of question. SharePoint newbie here (5 weeks in SP), Hehhehe!

    If you can redirect your request on context.....you can try this line of code
    <UrlActionUrl=”~site/_layouts/ItemAudit.aspx?ID={ItemId}&amp;List={ListId}”/>
    The Idea is to send in query string parameter and get the ItemID in the Pageload Event of the page you want to redirect to.
    Other tokens that are available
    Token
    Replaced By
    ~site/
    SPContext.Current.Web.ServerRelativeUrl
    ~sitecollection/
    SPContext.Current.Site.ServerRelativeUrl
    {ItemId}
    item.ID.ToString()
    {ItemUrl}
    item.Url
    {SiteUrl}
    web.Url
    {ListId}
    list.ID.ToString(“B”)
    {RecurrenceId}
    item.RecurrenceID
    Srikant N , MCPD SharePoint Developer 2010

  • How to get list of attachments for FI documents?

    Hi,
    We have a requirement where in we need to fetch the documents from BKPF and output these documents if they do not have any attachments.
    Now the issue is to find if the documents have any attchamnets or not. We came acroos the link table TOA01 and TOA02 for BKPF. But these does not satisfy our requirement completely as there are documents with attchaments but not maintained in these link tables.
    Please let me know if there any generic way like  methods of classes  to find the attachments for the documents??
    Thank You.
    Regards,
    Mallika.

    HI Mallika,
    You can make use of the Transaction OAAD by giving the Business object  BKPF as the Key field and it will pull up all the documents  that are attached .
    Regards
    Swarna.

  • Get list items using spservices for sharepoint 2013

    Hi,
    I have a requirement like below.
    I have 2 sharepoint custom list with some columns.
    List1:listA
    List2:listB
    Now when i open the listB new item form i want some of the field values from listA should auto populate in Textboxes of listB new form.
    Is there any ways to implement this?
    Regards,
    Poovi

    Hi Poovi,
    You can achieve this using jQuery to get the SharePoint list items. Refer the below articles. It has explained how to get list items using jQuery and auto populate a text-box from a list item as a source.
    You can put this code in list forms through SharePoint Designer. The articles explain about auto populating text box of web part but similarly you can implement it for list form, because nevertheless the text boxes are same.
    http://www.c-sharpcorner.com/UploadFile/sagarp/sharepoint-2010-jquery-autocomplete-textbox-containing-list/
    http://tomvangaever.be/blogv2/2011/07/sharepoint-2010-autocomplete-with-list-items/
    Please remember to click 'Mark as Answer' if the reply answers your query or 'Upvote' if it helps you.

  • How to get list name through javascript?

    Hi,
    I wrote javascript for getting list items but here I'm hard coded list name as "Projects"(my list name). How can I get list name automatically with out hard coding,
    Appreciate if anyone help.
    Thank you.
    function DoLogicalDelete()
    var clientContext = null;
    var oList = null;
    var oListItem = null;
    // var lstItmIsDeleted = null;
    var itmID = getQuerystring('ID');
    clientContext = SP.ClientContext.get_current();
    oList = clientContext.get_web().get_lists().getByTitle('Projects');
    // var oListItemID = SP.ListOperation.Selection.getSelectedItems(clientContext);
    oListItem = oList.getItemById(itmID); // getting ID
    clientContext.load(oListItem,"Title", "IsDeleted"); // load items to oListItem
    oListItem.set_item('IsDeleted', true);
    oListItem.update();
    clientContext.executeQueryAsync(Function.createDelegate(this, this.onQuerySucceeded),Function.createDelegate(this, this.onQueryFailed));

    Not sure on which context you are executing the code. If you executing this from the list form and trying to get the current list, then you may need to get the list name from the breadcrumb/list title field. Refer to the following posts for more information
    http://sharepoint.stackexchange.com/questions/39008/how-to-get-list-name-from-js-object-model-list-name-from-url-problem
    http://itrob.be/sharepoint-get-all-lists-names-in-javascript-spservice-and-jquery/
    --Cheers

  • How to get page item list in  a page?

    how to get page item list in  a page?

    Have a look at ISpread::GetItemsOnPage().
    That should get you started.

  • How to get list of active users with the details like samaccountname, name, department, job tittle, email in active directoy?

    how to get list of active users with the details like samaccountname, name, department, job tittle, email in active directoy?

    You can use third party software True Last Logon 2.9.You can export the file in excel for report creation.You can use the trial version this will achieve what you are looking for.
    True Last Logon displays the following Active Directory information:
    --Users real name and logon name
    --Detailed account status
    --Last Logon Date & Time
    --Last Logon Timestamp (Replicated value)
    --Account Expiry Date & Time
    --Enabled or Disabled Account
    --Locked Accounts
    --Password Expires
    --Password Last Set Date & Time
    --Logon Count
    --Bad Password Count
    --Expiry Date
    --You can also query for any other attribute (Example: Description, telephone Number, custom attibutes etc)
    Refer the below link for trial version:
    http://www.dovestones.com/products/True_Last_Logon.asp
    Best Regards,
    Sandesh Dubey.
    MCSE|MCSA:Messaging|MCTS|MCITP:Enterprise Adminitrator |
    My Blog
    Disclaimer: This posting is provided "AS IS" with no warranties or guarantees , and confers no rights.

  • 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

  • How to get work item details programatically ?

    Hi All,
    I have a list of work items (process instances) and I want to retrieve each item details such as: attachments, notes, id, ...
    All the items are filtered and represented as Fuego.Papi.Instance:
    Fuego.Papi.Instance[] inst = busProcess.getInstancesByFilter(filter : instFilter);
    But the work item details are inherited from Fuego.Lib.ProcessInstance. So, how to get the item details from inst[] ?
    Would appreciate any help, may be Dan will have an advise ?
    Regards,
    Kim

    If you have instances returned by your filter, you could extract variable information for each instance by doing something like this:
    for each inst in getInstancesByFilter(ps, filter : instF) do
        // here's how to get the value inside a primitive instance variable
        orderAmtObj as Object = getVar(inst, var : "orderAmount")
        // here's how to get the value of attributes inside a complex BPM Object instance variable
        //    - in this case this is an "order" object with two attributes (customerName and amount)
        orderObj as Object = (getVar(inst, var : "order"))
        xmlObject = Fuego.Xml.XMLObject(createXmlTextFor(DynamicXml, object : orderObj, topLevelTag : "xsi"))
        logMessage "The value of the order object's customer name is: " +
               selectString(xmlObject, xpath : "customerName")
        logMessage "The value of the order object's order amount is: " +
               selectNumber(xmlObject, xpath : "amount")
        // here's a rather uninspired way to retrieve who the participant is that was assigned the instance
        logMessage "The participant assigned to this instance is: " + inst.participantId
    endInside the above "for" loop, you could retrieve these predefined variables (this example assumes you use "inst" in your "for" loop):
        objRet as Any
        objRet = inst.getVar(var : "PREDEFINE_ACTIVITY")
        logMessage "Activity name = " + objRet using severity = DEBUGSubstitute "PREDEFINE_ACTIVITY" in the above logic to get this information:
    PREDEFINE_PRIORITY (priority)
    PREDEFINE_ACTIVITY_DEADLINE (activity.deadline)
    PREDEFINE_CREATION_TIME (creation.time)
    PREDEFINE_PROCESS_DEADLINE (deadline)
    PREDEFINE_DESCRIPTION (description)
    PREDEFINE_PROCESS (process)
    PREDEFINE_RECEIVED_TIME (receptionTime)
    PREDEFINE_PARTICIPANT (participant)
    PREDEFINE_COPY (id.copy)
    PREDEFINE_STATUS (status)
    Similarly, you might want to try to get instance information using the Fuego.Papi.VarDefinition object a try. Never used it, but the logic might be as simple as:
        logMessage "who created? = " + inst.getVar(Fuego.Papi.VarDefinition.CREATOR_ID) using severity = DEBUG
        logMessage "does it have attachments? = " + inst.getVar(Fuego.Papi.VarDefinition.HAS_ATTACHMENTS) using severity = DEBUG   
        logMessage "does it have notes? = " + inst.getVar(Fuego.Papi.VarDefinition.hasnotes) using severity = DEBUGDan

  • Better way how to get list of all classpath URLs in runtime

    Hello everyone,
    How to get list of all classpath items (URLs) in runtime from Java code?
    I am aware of solution based on System.getProperty("java.class.path"). Is there any alternative?
    This solution has several drawbacks. You have to parse String output. And I not sure if it contains ALL resources (JARs, class directories) loaded by ClassLoader or just reflects -cp arguments.
    Does system property "java.class.path" contain ALL loaded JARs?
    Does it contain items (JARs, class directories) loaded by bootstrap classpath?
    What about JARs loaded in runtime?
    Is the separator ":" always same on all operation systems?
    I was looking for some Java API based solution, method like List<URL> getAllClasspathItems()
    But there is nothing like this in ClassLoader, Class, Runtime or System classes.
    For curious, here is code I use.
    String classpath = System.getProperty("java.class.path");
    StringTokenizer st = new StringTokenizer(classpath, ":");
    while (st.hasMoreElements()) {
         System.out.println(st.nextElement());
    }

    For curious, here are output prints for all 3 methods:
    1) parsing system property
    2) tschodt
    3) overcast SystemClassLoader to URLClassLoader
    /home/espinosa/workspace/jboss_embedded_test1/target/test-classes
    /home/espinosa/workspace/jboss_embedded_test1/target/classes
    /opt/javalibs/javax/ejb/ejb-api/3.0/ejb-api-3.0.jar
    /opt/javalibs/javax/jms/jms/1.1/jms-1.1.jar
    /opt/javalibs/javax/annotation/jsr250-api/1.0/jsr250-api-1.0.jar
    package com.sun.org.apache.xerces.internal.impl.validation, Java Platform API Specification, version 1.6
    package com.thoughtworks.qdox.directorywalker
    package com.sun.org.apache.xerces.internal.parsers, Java Platform API Specification, version 1.6
    package java.util.jar, Java Platform API Specification, version 1.6
    package org.testng.internal.thread
    package com.sun.org.apache.xerces.internal.util, Java Platform API Specification, version 1.6
    package java.net, Java Platform API Specification, version 1.6
    package sun.reflect.misc, Java Platform API Specification, version 1.6
    package esp.ejb.samples1.test
    package sun.security.provider, Java Platform API Specification, version 1.
    file:/home/espinosa/workspace/jboss_embedded_test1/target/test-classes/
    file:/home/espinosa/workspace/jboss_embedded_test1/target/classes/
    file:/opt/javalibs/javax/ejb/ejb-api/3.0/ejb-api-3.0.jar
    file:/opt/javalibs/javax/jms/jms/1.1/jms-1.1.jar
    file:/opt/javalibs/javax/annotation/jsr250-api/1.0/jsr250-api-1.0.jar
    ...Interestingly, method 1 and 3 gives the same list, same order, same count, just format of item is a little bit different. The order is same as in Eclipse .classpath file.
    Method 2 (tschodt) give significantly more items! rougly 3x! Different order (somewhat random it seems to me). Some items contain extra information, like version and string "Java Platform API Specification".
    It prints not absolute paths but logical Java names.

  • How to get list of fonts on current system(forms6i)

    Does anyone know how to get list of all available fonts on system. I want to add available fonts to list item (forms 6i) dinamicaly.

    depending on what exactly you want to know:
    System.getProperty("java.version")
    System.getProperty("java.vendor")
    System.getProperty("java.vm.version")
    System.getProperty("java.vm.vendor")
    System.getProperty("java.vm.name")
    Nick.

  • Please tell me how to handle list item in this concern

    please tell me how to handle list item in this concern
    My problem is:
    i have a category table with column categoryname(varchar type)
    I want to display the records of categoryname in a drop down list (i.e., list item )
    So ..please tell me how to do it
    Thanks in advance..

    This code is just a sample from the Help documentation. It won't work until you modify it for your form.
    Why do you have "steps" in your code? You are suppose to do what the steps tell you. You don't place the steps in your code. The steps must be removed from your code.
    Step 1 code goes in a program unit, not in a trigger.
    Step 2 and 3 code usually goes in a trigger.
    You will have to replace the names of the items and record group with your own names as you have defined them in your form.
    step 1: create a procedure in your application
    procedure load_list(itm in VARCHAR2, rg in VARCHAR2) is
    group_id RecordGroup := Find_Group(rg);
    list_id Item := Find_Item(itm);
    Begin
    if Populate_Group(group_id)<>0 then
    Message('Unable to populate record group');
    Raise Form_Trigger_Failure;
    end if;
    Clear_List(list_id);
    Populate_list(list_id, group_id);
    end;
    step 2: create a record group named rg_cat and assign Record Group Query to something like "select categoryname from category"
    step 3: call this procedure as
    load_list('categoryname','rg_cat');

Maybe you are looking for

  • NFe de devolução com referencia a Cupom Fiscal - Versão 3.10

    Olá pessoal, boa tarde! Tenho o seguinte cenário em uma instalação de IS-Retail. O sistema legado no PDV não emite notas fiscais eletrônicas para acobertar processos de devolução de vendas. Este processos, eram realizados no ECC para a versão 2.0 sem

  • SSO to Web Application from Portal

    Hi,     I am working on a scenario where I need to access a Web Application from the Portal.     I read about the Application Integrator that is provided by the Portal .     I wanted to know that can I only have SSO to those Web Application that acce

  • What's the best XML for JAVA?

    Hi There, My big question is what should I use for develop a normal XML document, that can: - contain BASE64 strings - support UTF-8 add attributes, etc. I then want to pick this document and: - do it's parsing (walk trough) - apply a xsl to this doc

  • I am being told my safari is out of date can you help

    I keep getting messages that my safari is out of date Tried software update (under file) and it says my software is up to date. If I do update safari from site which one do I want Thanks Spencer

  • Regarding path resolution for PDF document

    Migration from weblogic 5 to 7.We are having problems while accessing PDF files from a particular folder(say C:\PDF\324322_a.pdf).We are using a utility called eMatrix to check out the PDF files to a particular location and the path of the location i