To search only images in a particular folder of picture library using content search webpart.

I have Images library where i am storing images in different folders.I need my content search webpart to search and display images in a particular folder in Images Library.For ex: i need to if my Picture Library Name is 'Images' a folder inside that is
'Travel' which is having some images.I need my content search webpart to pick images from 'Travel' folder only.Any pointers to this will be helpful.

Hi,
According to your post, my understanding is that you want to search images in a particular folder via content search web part.
When we use the search crawl the items in the images library, it crawls the items and folder with the following URL.
For folder: http://sp13/PublishingImages/Folder1.
For Items:
http://sp13/PublishingImages/Forms/DispForm.aspx?ID=itemID
It not crawls the items as the path
http://sp13/PublishingImages/Folder1/Item, then we could not use this path to retrieve the items in the folder.
As a workaround, we can create a custom field in the image library, such as a choice type field named
Folders(it contains the folder names), when we create a image, we set the folder name in this field.
Note: we should new a managed property manually to match the Crawled property.
Then we can use this field to filter the items in a particular folder as below, it works like a charm in  my environment.
path:"http://sp13/PublishingImages"   Folders=Folder1
Thanks & Regards,
Jason
Jason Guo
TechNet Community Support

Similar Messages

  • Using Content search web part to retrieve items from another site collection

    I have a web application that contains two site collections(team site + enterprise wiki), with the following URLs:-
    -http://applicationname/teamsite
    -http://applicationname/enterprisewiki
    Now I need to display the latest 10 wiki pages from the enterprise wiki site collection(according to the modified date) inside the team site. So I read that using Content search web part allow for cross-site content query. Currently I added a new content
    search web part , inside my team site, and I click on “change query” button. But I am not sure how I can reference the enterprise wiki site collection's wiki page library and to specify that I need to get the latest 10 wiki pages , inside the following dialog:-
    Basically this setting partially worked for me, I provide the following settings inside the “Build Your Query” dialog:-
    From the “Select a Query” I defined the following:- “items matching content type(system).”
    Restrict by app : “Do not restrict results by app”
    Restrict by content type “Enterprise Wiki Page”.
    This showed all the sites, lists and even pages are based on the “Enterprise Wiki Page” content type. But I am facing these three problems:-
    1. The above setting showed only the sites,lists and pages matching the “Enterprise Wiki Page” content type, that exists on another web application, and not that exists inside the current web application.
    2. To test the web part , I got the following results, But I was not able to add additional info for the items such as created by, modified by ,etc.
    3.  Also there is no way to sort the wiki pages by the modified date, as in the Sorting tab inside the “Build Your query” dialog I cannot find the “modified” inside the Soft by list
    So can anyone advice how to fix these three problems

    Hi,
    1. In "Build Your Query" dialog, we can select "Specify a URL" in
    Restrict by app and enter another site URL.
    2. If you want to add more information for the items, we need customize the display template, the following link for your reference:
    http://blogs.technet.com/b/sharepoint_quick_reads/archive/2013/08/01/sharepoint-2013-customize-display-template-for-content-by-search-web-part-cswp-part-1.aspx
    3. In the Sorting tab, we can use "LastModifiedTime" to instead of "Modified".
    Best Regards 
    Dennis Guo
    TechNet Community Support

  • How to retrive latest items from different site collection using content search web part

    I have a web application that contains two site collections(team site + enterprise wiki), with the following URLs:-
    -http://applicationname/teamsite
    -http://applicationname/enterprisewik
    Now I need to display the latest 10 wiki pages that are inside the enterprise wiki site collection (according to the modified date) inside the team site. So I read that using Content search web part allows for cross-site content query.
    So I added a new content search web part , inside my team site, and I click on “change query” button. But I am not sure how I can reference the enterprise wiki site collection's library and to specify that I need to get the latest 10 wiki pages using the
    content search web part's query dialog box? Can anyone advice please ?
    Thanks

    Edit the webpart and click change query in search criteria.  click on switch to advanced mode and enter your path:
    (path:"http://applicationname/teamsite" OR path:"http://applicationname/enterprisewik")
    you can specify sorting by created date and click ok.  in number of items to show, type 10.  this should fulfill your requirement.
    For further reading, here are some links:
    http://office.microsoft.com/en-001/office365-sharepoint-online-enterprise-help/configure-a-content-search-web-part-in-sharepoint-HA104119042.aspx
    http://blogs.technet.com/b/tothesharepoint/archive/2013/04/30/stage-9-configure-the-
    query-in-a-content-search-web-part-on-a-category-page.aspx
    http://blogs.technet.com/b/tothesharepoint/archive/2013/05/23/stage-10-configure-the-query-in-a-content-search-web-part-on-a-catalog-item-page.aspx
    kashif

  • Show only images in the selected folder

    Hi All,
    It would be nice if I could show only the images in the selected folder without including images in subfolders. For example a check box next to the folder name could switch between "selected folder only" and "include subfolders" viewing modes.

    Un-check Menu/Library/Include Photos from Subitems.
    It is already there in V1.1.
    Don
    Don Ricklin, MacBook 1.83Ghz Duo 2 Core running 10.4.10 & Win XP, Pentax *ist D
    http://donricklin.blogspot.com/

  • How to display Column of a particular list to page using Content Search Webpart?

    Hi,
    I am having two columns 'Column1 & Column2' in a list names Demo. I need to display the items of both the columns into a page with the help of Content Search Webpart. I am using SharePoint 2013 Platform.
    Expecting some useful comments on the same...!!
    Warm Regards,
    Tony Joy.

    Hi,
    If you just want to display two columns of a list, Content Query Web Part will be more appropriate:
    http://community.bamboosolutions.com/blogs/sharepoint-2013/archive/2013/05/10/how-to-use-the-content-query-web-part-to-rollup-data-in-sharepoint-2013.aspx
    To display multiple columns, here is a similar thread for your reference:
    http://social.technet.microsoft.com/Forums/sharepoint/en-US/1484df2b-0fb9-4b58-b833-a75019db88c7/content-query-display-multiple-columns
    Best regards
    Patrick Liang
    TechNet Community Support

  • How to add folder in picture library programmatically

     
    Hi All,
    I tried to add folder using below code but getting error of "Missing FileLeaf"
    try
                    if (properties.List.Title.ToString() == Utility.ListName.Events.ToString())
                        using (SPSite objSite = properties.Site)
                            using (SPWeb objWeb = properties.Web)
                                SPListItem lstEvent = properties.ListItem;
                                string folderName = Convert.ToString(lstEvent["Title"]) + "_" + DateTime.Now.ToShortDateString();
                                if (!string.IsNullOrEmpty(folderName))
                                    SPList lstEventPictures = objWeb.Lists.TryGetList(Utility.LibraryName.EventPictures.ToString());
                                    if (lstEventPictures != null)
                                        objWeb.AllowUnsafeUpdates = true;
                                        //SPListItemCollection folders = lstEventPictures.Folders;
                                        //folders.Add(lstEventPictures.RootFolder.ServerRelativeUrl 
    , SPFileSystemObjectType.Folder , folderName);
                                        ///* create a folder under the path specified
                                        SPListItem folderItem = lstEventPictures.Items.Add(lstEventPictures.RootFolder.ServerRelativeUrl,
    SPFileSystemObjectType.Folder , folderName);
                                        ///* set the folder name and update */
                                        //folderItem["Title"] = folderName;
                                        folderItem.Update();
                                        lstEventPictures.Update();
                                        objWeb.AllowUnsafeUpdates = false;
                catch (Exception ex)
                    Utility.SPTraceLogError(ex);
    Help me to resolve. Thanks in advance.

    Hi DK,
    You can use below mentioned code to add folder in any of your library. You need to changes little bit code as per your requirement.
    /// <summary>
    /// Provide utilities methods related to folder management
    /// </summary>
    public static class SPFolderUtilities
        /// <summary>
        /// Ensures the specified folder exists.
        /// </summary>
        /// <param name="list">The list where to create the folder.</param>
        /// <param name="subFolderPath">The sub folder path.</param>
        /// <returns>
        /// The existing <see cref="SPFolder"/> or a newly created if it did not exists.
        /// </returns>
        public static SPFolder EnsureFolder(SPList list, string subFolderPath)
            Contract.Requires<ArgumentNullException>(list != null);
            Contract.Requires<ArgumentNullException>(!string.IsNullOrEmpty(subFolderPath));
            if (!IO.SPPathUtilities.IsFileOrFolderNameValid(subFolderPath, true))
                throw new ArgumentException("Invalid characters in the file or folder name", "subFolderPath");
            var folderPaths = subFolderPath.Split('/');
            var currentFolder = list.RootFolder;
            for (int i = 0; i < folderPaths.Length; i++)
                currentFolder = list.ParentWeb.GetFolder(currentFolder.Url); // hacky refresh
                var subFolder = currentFolder.SubFolders.Cast<SPFolder>().FirstOrDefault(f => string.Compare(f.Name, folderPaths[i], true) == 0);
                if (subFolder == null)
                    var newFolderItem = list.Items.Add(currentFolder.ServerRelativeUrl, SPFileSystemObjectType.Folder, folderPaths[i]);
                    newFolderItem.SystemUpdate();
                    subFolder = newFolderItem.Folder;
                currentFolder = subFolder;
            return currentFolder;
    And here is the specifc code that you can use for Picture library only
    Question
    Vote as helpful
    0
    Vote
    yes the code sample provided by you is to create a image library and then to add a folder to it but i'm not sure with the string.empty being passed to list.items.add. i would still recommend to use the solution suggested by me. to check if library exists or
    not what you have to do is 
    SPSite _MySite = new SPSite("SERVERIP");  
                    using (SPWeb currentweb = _MySite.OpenWeb())
    SPList imageLib = currentweb.Lists["NewImages]
    if( imageLib == null)
    Guid listId = currentweb.Lists.Add("NewImages", "Picture Library", SPListTemplateType.PictureLibrary);
     imageLib t = currentweb.Lists[listId];    
    SPDocumentLibrary
     _MyDocLibrary =
    (SPDocumentLibrary)
    imageLib ;
                     SPFolderCollection _MyFolders = _MyWeb.Folders;
                    _MyFolders.Add("http://adfsaccount:2222/My%20Images/" + <<subfolderName>> + "/");
                    _MyDocLibrary.Update();
    I hope this is helpful to you, mark it as Helpful.
    If this works, Please mark it as Answered.
    Regards,
    Dharmendra Singh (MCPD-EA | MCTS)
    Blog : http://sharepoint-community.net/profile/DharmendraSingh

  • Save canvas as image to the picture library using c#,xaml in windows 8.1

    Hi everyone,
    I am developing a small paint application in that I am using canvas as a drawing area. Now I need to save that drawing as an image to the picture library.
    How can I do this?
    Please help me.
    Thanks in advance

    Use RenderTargetBitmap to render your Canvas into a bitmap. Use BitmapEncoder to encode the bitmap as a JPG or png, then save it our with a StorageFile.
    See the sample at
    http://code.msdn.microsoft.com/windowsapps/XAML-render-to-bitmap-dd4f549f

  • Windows 8 search not working for on particular folder on external HDD

    I have an external HDD which has a library of pdf documents on it (about 11gigs worth) - it's in my index and it used to be perfectly searchable by windows search until I had the files system converted to NTFS from FAT32.  Now it literally will not
    find anything in the folder with all the pdfs in it (even if you search "pdf" it wont find a single thing) yet it will find anything else in any other folder on the same drive.
    I have no idea what the problem is.  That folder is also shared, and is a google drive.  Any ideas would be appreciated, thanks, DB

    check out this link:
    http://www.softwareok.com/?seite=faq-Windows-8&faq=78
    from above link:
    To change the Windows-8 indexing options, please open Indexing Options Window. Press the key combination [Windows Logo] + [R],
    then just type the command control.exe srchadmin.dll [...
    see Image 1 Arrow-1]
    Click Modify [...
    see Image 1 Arrow-2] and please check the mark in the checkbox of the folders that you want[...
    see Image 1 Arrow-4]
    (Image-1) Windows-8 Indexing Options and Indexed Locations.
    Every second counts..make use of it. Disclaimer: This posting is provided AS IS with no warranties or guarantees and confers no rights.

  • Create folder in Document Library using Sharepoint 2010 Client Object Model

    I would like to check for the existence of a folder in s Sharepoint 2010 Document Library and if the folder is not found, create it. (I would then subsequently programmatically upload documents to that folder -- which I have figured out). Can someone
    please help me figure out how to check for the extistence of and then create a folder using the Sharepoint 2010 Client Object Model?

    You can use this:
    public static void CreateFolder_ClientOM(string listName, string folderName)
    ClientContext clientContext = new ClientContext("http://basesmc2008");
    Web web = clientContext.Web;
    List list = clientContext.Web.Lists.GetByTitle(listName);
    clientContext.Load(clientContext.Site);
    string targetFolderUrl = listName + "/" + folderName;
    Folder folder = web.GetFolderByServerRelativeUrl(targetFolderUrl);
    clientContext.Load(folder);
    bool exists = false;
    try
    clientContext.ExecuteQuery();
    exists = true;
    catch (Exception ex)
    if (!exists)
    ContentTypeCollection listContentTypes = list.ContentTypes;
    clientContext.Load(listContentTypes, types => types.Include
    (type => type.Id, type => type.Name,
    type => type.Parent));
    var result = clientContext.LoadQuery(listContentTypes.Where
    (c => c.Name == "Folder"));
    clientContext.ExecuteQuery();
    ContentType folderContentType = result.FirstOrDefault();
    ListItemCreationInformation newItemInfo = new ListItemCreationInformation();
    newItemInfo.UnderlyingObjectType = FileSystemObjectType.Folder;
    newItemInfo.LeafName = folderName;
    ListItem newListItem = list.AddItem(newItemInfo);
    newListItem["ContentTypeId"] = folderContentType.Id.ToString();
    newListItem["Title"] = folderName;
    newListItem.Update();
    clientContext.Load(list);
    clientContext.ExecuteQuery();
    Blog | SharePoint Field Notes Dev Tool |
    ClassMaster

  • Query anonymous using Content Search Web Part

    I'm using the Content Serach Web Part in a template with public access, trying to query list data. It works fine when logged in, but as an anonymous user I get an error with correlation-id 000000000000-0000-0000-0000-000000000000. I do have anonymous
    access to the list data I query. Also I have added ViewFormPages to the AnonymousPermMask property as suggested, but with no luck.
    Anyone know how to search anonymous using the Content Serach Web Part, please share! Thanks in advance.

    http://social.msdn.microsoft.com/Forums/sharepoint/en-US/09a40222-36a4-472d-a9b8-28436ff3b78d/content-by-search-web-part-not-working-properly-for-anonymous-user?forum=sharepointdevelopment
    Please try to break inheritance permission for the anonymous users, and add ‘View Application Pages’ permission for them, it seems that the permission for anonymous users is moved by the lockdown feature, you can use the following PowerShell Script to change
    this:
    $web = get-spweb "http://yoursiteurl/subweb/subsubweb"
    $list = $web.Lists["ListName"]
    $list.BreakRoleInheritance($true)
    $list.AnonymousPermMask = $list.AnonymousPermMask -bor ([int][Microsoft.SharePoint.SPBasePermissions]::ViewFormPages) #binary or adding the permissions
    $list.Update()
    More information, How to Make List Items Visible to Anonymous Users (in Search):
    http://soerennielsen.wordpress.com/2012/05/29/how-to-make-list-items-visible-to-anonymous-users-in-search/
    http://www.mavention.com/blog/anonymous-search-results-cache-sharepoint-2013-public-websites
    <a:KeyValueOfstringanyType>
      <a:Key>TryCache</a:Key>
      <a:Value i:type="b:boolean"
    xmlns:b="http://www.w3.org/2001/XMLSchema">true</a:Value>
    </a:KeyValueOfstringanyType>
    http://magenic.com/BlogArchive/SharePoint2013ContentSearchWebPartsCatalogs
    http://blog.mastykarz.nl/inconvenient-anonymous-search-results-cache-user-segments/
    If this helped you resolve your issue, please mark it Answered

  • Picture Library : upload image with same name overwrite the image in thumbmail or WebVersion view but not the actual image link points to the old image

    Hello,
    I am facing a wired issue with Picture Libraries in SharePoint.
    We created a custom field and added it to UserInfo list, the column based on custom field lets user upload their personal images to a Picture Library with the name <User ID>.<Image Extension> e.g. 1.jpg where UserID is internal Listitem ID of the UserInfo list and set its URL to the field value which we use to display the image on our custom user profile and some other WebParts.
    If the user uploads a different image, it will overwrite the existing one it keeping the same name.
    The field worked perfectly with sites using widows Based authentication, but as we move the field to sites with form based authentication we find that the field is able to upload the image properly first time but on each successive upload, although a new image gets uploaded with the name userid.imagextension and is shown in the allitems.aspx page in the thumbnail view and in the picture preview on the dispform.aspx page, but the link next to the name field and the image shown on clicking the preview points to the old image.
    To put it other way
    https://<Web URL>/Picture%20Library/_w/Upload_jpg.jpg
    https://<Web Url>/Picture%20Library/_t/Upload_jpg.jpg
    Would show the updated image
    but the actual URL
    https://<Web Url>/Picture%20Library/Upload.jpg 
    points to the old image
    what’s even more strange is that even after deleting the image the url still shows the old image at
    https://<Web Url>/Picture%20Library/Upload.jpg 
    I confirmed the same by actually repeating the same exercise on a picture Library in the User Interface
    Uploading an image say upload.jpeg in the picture library using SharePoint interface.
    Then uploading a different jpeg image keeping the same name upload.jpeg again in the picture library.
    In allitems.aspx thumbnail view and on dispform.aspx page preview filed image now show the newly uploaded image but when you click the preview image or click the link in the name field value it takes you back to the old image.
    I have seen this issue on environment where we have enabled form based authentication and the issue is not seen on another server where we have wss with windows based authentication.
    Has anyone noticed such behavior and is there any workaround to that!
    Thanks & Regards
    Saurabh Rustagi

    All,
    I had the same issue. 
    In my case, Blob Cache was enabled for the web application in which the image issue was occuring.
    I cleared blob cache, and after doing a hard refresh of my browser, the correct image was then displayed.
    To clear blob cache, do the following:
    Navigate to:   
    http://yourwebapp:port/yoursite/_layouts/objectcachesettings.aspx
    Select:  "Object Cache Flush"  and  "Force all servers in the farm to flush their object cache" check boxes
    Click the OK button
    Hope this helps.

  • Indd - JS: Searching an image in subfolders and relinking

    Hi,
    Can any one help me....
    In an Indesign Document I want to relink all the images to a new path.
    Please see the below script, it search for the images in a specified path only. But i want to search the images in a particular directory along with its sub-folder too.
    var myFolder = Folder.selectDialog("Select Folder for Images");
    var new_path = myFolder+ '/'
    imgs = app.activeDocument.allGraphics
    for (i = 0; i < imgs.length; i++)
    img = imgs[i].itemLink
    myFile = File (new_path + img.name);
    if (myFile.exists) {
    img.relink (File (new_path + img.name))
    img.update()
    Thanks in advance,
    Bharathi Raja G.

    Hi Shanto,
    You can download a script for updating path names in links: http://www.businessweekly.h.com.ua/relink.html
    You select a folder, and, for every image in the active document, it searches for the file that has the same name as the old one, and if it's found, relinks it.
    If the file with the exact name is not found, the script tries to find a file with the same base name but a different extension (".psd", ".tif", ".jpg", ".ai", ".eps", ".pdf", ".indd").
    If the script doesn't find the new file in the chosen folder, it repeats the above-mentioned process for every subfolder.
    But this script was written for CS2/CS3 and I have doubt that it would work in CS. I can’t check this as I don’t have CS any more.
    To all appearance, Indesign files, you received, were created on Mac, but you are on PC. I remember this problem in CS – it has been corrected since CS2.
    In such cases I use the following workaround:
    1.Copy Indesign file to the folder where links located.
    2.Open it, Indesign should find all lost links in this folder and its subfolders.
    3.Save and close the document.
    4.Copy/move the Indesign file to its original location.
    Kasyan

  • Mail will not search in the "on my mac" folder

    Hi everyone,
    I've been trying to come up with a useful solution to essentially archive messages from an email account that is no longer active. I would like to keep these messages searchable in Mail though. I thought if I put them in the "On My Mac" Saved Mail Folder, they would remain searchable, however it appears Mail is not searching this mailbox. Is it just me? It seems like the functionality exists. For example if I select the saved mail on my mac folder and then attempt to search for a message in that folder I have the option of searching All, Saved Mail on My Mac, Inbox etc. but no results from the mailbox appear in the search. Is there any way to change this so I am able to search messages in this folder? Thanks!

    Hey thanks for the reply. My problem was solved by rebuilding the "on my mac" mailbox. Previously I was searching based on the title of an email that I knew was in the folder so I knew there was either a problem with my mail searching feature or it wasn't possible to search that folder.

  • BI Widgets 'Content Search' is not working

    Hi,
    I have BI Widgets installed on my comp. I can log in bobj server and take xcelsius/webi reports as a widget.
    I can see infoview folder tree and all reports in 'Document List Explorer' but when i type any words in
    'Content Search' no search results return . I need to use Content Search tool.
    Do i need any special configuration on BO server to make work 'Content Search' ?
    Thanks for all usefull answers..

    How did you solve it ??
    I am able to see all blanks in teh content.

  • Search by tag not working in content search web part

    Hi,
    I am trying to configure content search web part that only pull result with a specific tags. I have created a document library and assign tags on some document, also configured Managed Meta data service and search service application. Schedule search continuous
    crawl.
    If i am not specify any tag content search web part shows results but when I restrict result with specific tag like (#HomePage) it doesn't pull any result, i have also run crawl after tagging documents in document library.
    Kindly help me out.

    Lets suppose you have your "managed metadata property" added to your list/library with name "MetadataColumn". Crawled property is created  with name ows_MetadataColumn (I guess). Then You need to create a new managed property in
    search settings and map it to your crawled property (ows_...).
    Nothing else, use your Managed property in content search webpart and filter your results.
    MVS RAVI KUMAR

Maybe you are looking for