Sharepoint 2013 SPSitedataquery result trimming for Loggedin user

Hi,<o:p></o:p>
I am using SPSiteDataQuery to roll-up information from Site-collection, it fetches all the records from all the sites
inside that Site-Collection. Now I want to enable security trimming on the result.
For example if user has no access to a particular site (SPWeb) inside the Site-collection, records from that site should not be included in
result of SPSiteDataQuery.<o:p></o:p>
Please help me out.<o:p></o:p>
Regards,<o:p></o:p>
Mayank<o:p></o:p>
Mayank Nigam

Hi,                                                             
For your requirement, a workaround is that we can check whether the current login user has the permission needed, then perform the query job accordingly.
Gets the current user of the site with SPWeb.CurrentUser property
by using the a line of code like this:
SPContext.Current.Web.CurrentUser.LoginName
Indicates whether the specified user has a specified set of permissions:
SPWeb.DoesUserHavePermissions method
http://msdn.microsoft.com/en-us/library/ms441848.aspx
Another link about Check User Permissions Programmatically for your reference:
http://tad.co.in/gnosis/check-user-permissions-programmatically-in-sharepoint-2010/748
Best regards
Patrick Liang
TechNet Community Support

Similar Messages

  • SharePoint 2013 allows downloaded even for users with "view only" permissions

    I have a new on premises SharePoint 2013 server and assigned a single user "view only" rights to a document library. In the "permission levels" window, this permission is described as "Can view pages, list items,
    and documents. Document types with server-side file handlers can be viewed in the browser but not downloaded."
    Once I gave the user that permission, I noticed he was able to view documents in the library but the "but not downloaded" part does not seem to be working. The user can still download documents to his local desktop and SharePoint does not prevent
    it. The "download a copy" option appears and the user can use it.
    My goal is to make all documents in this library such that users can only view them in the browser and not download a local copy. How I do that?
    Thanks for your help.

    Not entirely positive :-) 
    However, you have no server-side handlers in place today without WAC installed, so that portion of the View Only permission wouldn't be applicable.
    Note that WAC must be installed on its own server and if your SharePoint server is extranet or public facing, it needs to have a valid, public SSL certificate. Also, WAC should always be run over SSL regardless if it is public facing or not as the token
    sent between the SharePoint server and WAC is the same as having a username and password for the user making the request.
    Trevor Seward
    Follow or contact me at...
    &nbsp&nbsp
    This post is my own opinion and does not necessarily reflect the opinion or view of Microsoft, its employees, or other MVPs.

  • If Condition in Keyword Query Language (SharePoint 2013 Search Results)

    Hi All,
    Can we have an "If" condition in Query text box in SharePoint 2013 Search results page. For example, i want to hide all list items whose
    status is "HideItem" from appearing in search results?
    I am trying this: {?{searchTerms} (contentclass:STS_ListItem -ListItemStatus:"HideItem")}
    But, this hides all items like aspx pages, pdf's, docs and displays only list items. 
    Similarly, hide pages of some name like: AllItems.aspx, ViewDetails.aspx, AllAssets.aspx 
    {?{searchTerms} (contentclass:STS_ListItem_850 -filename:"AllItems.aspx")} 
    Any help would be great. Thanks in advance.

    Thanks Steve. I found this solution after a bit of struggle :).
    Also, date comparision is not working as expected. 
    {?{searchTerms} NOT(contentclass:STS_ListItem AND ListItemStatus:"HideItem" AND
    PublishDate<{Today})} is not working and throwing syntax error.
    I don't see any solid reference to KQL syntax except this msdn link.
    Can you please suggest any good material on KQL syntax ?
    Thank you once again.

  • Open SharePoint 2013 Search Results (EML files) In The Client Application

    Hi, I have a problem about using sharepoint 2013 search for EML files:
    When i click on the search result link *.eml, the browser open for the email file, i can only view the content of the EML file, but actually i want to see the full info of it like using an email client application outlook express including From:,To:,Date:,Subject:,ect.
    How can i click on the search result link to open an email client application to view the result?
    Thanks a lot.

    Hi  ,
    According to your description, my understanding is that you want to open SharePoint 2013 Search Results (EML files) in the Client Application.
    For your issue, you can follow the steps as the blog’s:
    http://www.quercussolutions.com/blog/index.php/opening-eml-file-types-in-outlook-from-sharepoint-2010/
    Best Regards,
    Eric
    Eric Tao
    TechNet Community Support

  • Office Web Apps - Preview Sharepoint 2010 documents in Sharepoint 2013 Search Results...again

    Hi,
    I found a thread in this forum With an answere to a similiar question here:
    http://social.technet.microsoft.com/Forums/en-US/28bc1e27-4a65-4c61-9b3e-cb9dad17f779/office-web-apps-preview-sharepoint-2010-documents-in-sharepoint-2013-search-results?forum=sharepointsearch&prof=required
    ...With the answere:
    "OWA uses an access token to talk to SharePoint 2013.  It cannot use this when talking to 2010.  In order to work with 2010, you have to create a custom display template that converts the file url to an openurl link. "
    BUT...
    may anyone give more information how to do this?
    Links to articles? Links to description and samples?
    jik

    Hi,
    According to your description, my understanding is that you want to preview documents from SharePoint 2010 in search results in SharePoint 2013.
    Per my knowledge, the Office Web Apps is configured to work with SharePoint 2013, so it will not work with documents in SharePoint 2010.
    I recommend to configure Office Web Apps to work with SharePoint 2010
    and make sure that documents can be previewed in SharePoint 2010 using Office Web Apps to see if the documents can be previewed in SharePoint 2013 search result.
    http://technet.microsoft.com/en-us/library/ff431687(v=office.14).aspx
    Best regards.
    Thanks
    Victoria Xia
    TechNet Community Support

  • How to set a customized search results template for all users

    Hi.
    I know the customized search results views are stored in a file called pne_portal.hda that resides on every user's subfolder in data/users/profiles/...
    Is there a way to set a customized search results template for all users? If it's impossible, is there a way to modify the Headline view? I'm not able to find the resource or template where this view is.
    Thanks in advance.

    I wasn't able to understand what was meant by this post. Therefore, I modified the standard template HeadLine View.
    Columns for this template are defined in the include slim_search_result_table_header_setup (in std_page.htm).
    Here is the modification of the code:
    <$if customTemplateId and not (baseTemplateId like customTemplateId)$>
              <$columnsString = utGetValue("customlisttemplates/" & strLower(customTemplateId), "columns")$>          
              <!-- Modify START by Oracle-->
         <$else$>
    <!-- here add default fields -->
              <$columnsString="dDocName,dDocTitle,dInDate,dDocAuthor"$>
    <!-- here add your custom fields -->
              <$columnsString=columnsString&",xComment"$>
              <!-- Modify END by Oracle-->
         <$endif$>

  • Sharepoint 2013 returning results from userprofiles

    Hello, I need some help in cleaning up the results from a search query.
    I've created a new page within SharePoint 2013 and added 2 script editors.
    One script editor holds a search box:
    <div unselectable="on">
    <label unselectable="on">First Name Search: </label>
    <input id="searchTextBox" type="text">
    <input id="getColleagues" type="button" value="Search">
    </div>
    <div id="resultsDiv" unselectable="on">
    </div>
    The other holds the search query:
    <script src="http://site/SiteAssets/jquery.min.js"></script>
    <script type="text/javascript">
    $(document).ready(function () {
    var spAppWebUrl = "http://site";
    $("#searchButton").click(function () {
    //var queryUrl = spAppWebUrl + "/_api/search/query?querytext='" + $("#searchTextBox").val() + "'";
    var wildcard = $("#searchTextBox").val() + "*";
    var queryUrl = spAppWebUrl + "/_api/search/query?querytext='*'&sourceid='b09a7990-05ea-4af9-81ef-edfab16c4e31'&rowlimit='500'&selectproperties='FirstName, LastName, PictureURL, SipAddress, PreferredName, WorkEmail'&refinementfilters='FirstName:"+ (wildcard) + "'";
    alert(queryUrl);
    $.ajax({ url: queryUrl, method: "GET", headers: { "Accept": "application/json; odata=verbose" }, success: onQuerySuccess, error: onQueryError });
    function onQuerySuccess(data) {
    var results = data.d.query.PrimaryQueryResult.RelevantResults.Table.Rows.results;
    $("#resultsDiv").append('<table>');
    $.each(results, function () {
    $("#resultsDiv").append('<tr>');
    $.each(this.Cells.results, function () {
    $("#resultsDiv").append('<td>' + this.Value + '</td>');
    $("#resultsDiv").append('</tr>');
    $("#resultsDiv").append('</table>');
    function onQueryError(error) {
    $("#resultsDiv").append(error.statusText)
    </script>
    I am getting results, but not just the selectedproperties: FirstName, LastName, PictureURL, SipAddress, PreferredName, WorkEmail.
    Can someone help me to get just the selectedproperties of FirstName, LastName, PictureURL, SipAddress, PreferredName, WorkEmail?
    Thanks

    Hi,
    According to your post, my understanding is that you want to get the User Profile properties using REST API.
    If you want to use Search Query, here is a tool for your reference:
    http://sp2013searchtool.codeplex.com/
    If you just want to get the User Profile properties, we can use SP.UserProfiles.PeopleManager
    to achieve it.
    Example:
    Get Multiple Properties for the current user:
    http://siteurl/_api/SP.UserProfiles.PeopleManager/GetMyProperties?$select=PictureUrl,AccountName
    More information is here:
    http://www.vrdmn.com/2013/07/sharepoint-2013-get-userprofile.html
    Best Regards
    Dennis Guo
    TechNet Community Support

  • Office web Apps preview of SharePoint 2010 source in SharePoint 2013 search results

    Hi Team,
    We have crawled SharePoint 2010 source in SharePoint 2013 and able to get results successfully. Now our requirement is to show Office Web Apps previes of 2010 documents in 2013 search results.
    Any guidance on this please.
    Thanks,
    Manjeera

    Hi,
    Take a look at this blog post on how to do this: http://blogs.msdn.com/b/murads/archive/2012/10/11/utilizing-web-apps-2010-to-get-powerpoint-previews-of-sharepoint-2010-content-from-sharepoint-2013-search.aspx
    Thanks,
    Mikael Svenson
    Search Enthusiast - SharePoint MVP/MCT/MCPD - If you find an answer useful, please up-vote it.
    http://techmikael.blogspot.com/
    Author of Working with FAST Search Server 2010 for SharePoint

  • Sharepoint 2013 obtain alternative value for outcome local variable

      When a user either rejects or accepts a task that they have been assigned
    to in the 'start a process action task, the outcome local variable value is either 0 or 1.    Right now I am updating a custom list with the value obtained from the local variable called 'outcome'. Is there a way to obtain the outcome value
    as 'rejected' or 'accepted' instead of 0 or 1? If so can you tell me how to change the outcome values?

    Hi wendy,
    For your issue, you can add a condition in your workflow as below:
    Then you can update a custom list with 'rejected' or 'accepted' based on the value obtained from the local variable called 'outcome'.
    Another way, you can create a custom Task Outcome with the value you want to use:
    http://sivarajan.me/post/SharePoint-2013-Designer-Workflow-Creating-a-Custom-Task-Outcome-Part-3
    Thanks,
    Eric
    Forum Support
    Please remember to mark the replies as answers if they help and unmark them if they provide no help. If you have feedback for TechNet Subscriber Support, contact
    [email protected]
    Eric Tao
    TechNet Community Support

  • How to Enable Anonymous access to a SharePoint 2013 site e.g for specific site,list etc..

    Hi All,
          I'm working on an extranet and i would like users to be able to fill a form on the site.
    Since i'm going to use sharepoint 2013 how can i configure sharepoint to use both anonymous access and windows authentication at the same time.
    I know for sure it can be done but what can be allowed for anonymous access e.g specific list site etc..
    I would need to make some area available as anonymous e.g a whole site as  i would like to brand it a little to host the form.Any tips of who has configured similar would be appreciated

    Hi Patrick,
    Thanks for posting your query, Kindly follow the below mentioned steps to enable Anonymous access to a SharePoint 2013 site.
    In Central Administration, under Application Management., click Manage web applications.
    Select the web application you want to enable anonymous access for.
    In the Security group on the ribbon, click Authentication Providers.
    In the Authentication Providers dialog box, under Zone, click Default.
    On the Edit Authentication page, select the Enable anonymous access check box.
    Click Save.
    Close the Authentication Providers dialog box.
    Also, browse the below mentioned URLs for more details
    http://blog.cloudshare.com/2012/10/15/how-to-enable-anonymous-access-to-a-sharepoint-2013-site/
    http://www.sharepoint-journey.com/how-to-enable-anonymous-access-in-sharepoint-2013.html
    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

  • Sharepoint 2013 master page branding for public site

    We have created one SharePoint 2013 public site in office 365.
    We create a custom master page for entire site.when i am login with particular user then its fine.but for anonymous user publishing page design and content not properly view.
    please provide me proper solution for publishing page layout that works with anonymous user.

    You should be able to configure this within the library settings of the master page library as below.
    Steven Andrews
    SharePoint Business Analyst: LiveNation Entertainment
    Blog: baron72.wordpress.com
    Twitter: Follow @backpackerd00d
    My Wiki Articles:
    CodePlex Corner Series
    Please remember to mark your question as "answered" if this solves (or helps) your problem.

  • SharePoint 2013 access to custom lists a user creates

    In an InfoPath custom list form 2013, I have setup a group of test users with 'view' access to my test SharePoint website. These users are able to enter data in a custom list.
    When the user looks at the data that they originally entered by accessing the data from the sharepoint website, the InfoPath Form looks like the form is read only. However if the user clicks the auto generated edit buttons on the top of the form, they are
    able to change the data in the list.
    Basically I would like a way for the user to not be able to change the original data in the custom list.
    Is there a way that I can accomplish this goal like:
    1. disable the autogenerated buttons,
    2. have all the textboxes set as read only,
    3. change some kind of an access level?
     Would you let me know what method works and how to accomplish my goal?

    In InfoPath Designer go to File, Info, Form Options.
    In the Web Browser category uncheck Show InfoPath Commands in Ribbon or Toolbar.
    Mike Smith TechTrainingNotes.blogspot.com
    Books:
    SharePoint 2007 2010 Customization for the Site Owner,
    SharePoint 2010 Security for the Site Owner

  • Office Web Apps - Preview Sharepoint 2010 documents in Sharepoint 2013 Search Results

    Hi,
    We have a Sharepoint 2013 search site collection. The content sources for the Search service application includes some Sharepoint 2010 sites. We also have Office Web Apps server deployed. When searching for documents, the OWA preview works for all the document
    in local sharepoint 2013 farm. However document preview doesn't work for documents in the sharepoint 2010 farm.
    Any idea why this happens?
    Regards,
    Muthu

    Could you please elaborate more on open url / please give us some syntax how to use that is display template?
    When we use open url do we still need to install office webapps in the 2010 environment? 

  • SharePoint 2013 SQL Server Edition for BI Features - must be on SharePoint SQL Server?

    I need to install SQL Server 2012 for a new SharePoint 2013 installation.
    Let's say I want to use the BI features of SharePoint 2013 like PowerView.
    I already have a separate SQL Server running SQL Server 2012 BI Edition that is used as the database server for our data warehouse and some apps.  But this SQL Server will not be used to house the SharePoint 2013 databases.
    Do I need to install SQL Server 2013 BI Edition on the SharePoint 2013 SQL Server (where the SharePoint 2013 databases will be housed) or can I used SQL Server 2013 Standard Edition on that server and utilize the BI Edition on the data warehouse server to
    use the BI features of SharePoint?

    Yes, BI or Enterprise must be installed on the SharePoint server in order to integrate SSRS. PowerPivot can be on a separate server with just a download (http://www.microsoft.com/en-us/download/details.aspx?id=35577) for certain components residing on
    the SharePoint server. This will give you PowerView, as well.
    Trevor Seward
    Follow or contact me at...
    &nbsp&nbsp
    This post is my own opinion and does not necessarily reflect the opinion or view of Microsoft, its employees, or other MVPs.

  • How to publish a sharepoint web application to internet for external users.

    Hi
    how to publish a share point site to internet,
    In test server : we branded a publishing enabled site and uploaded content and want to publish for internet users
    we have a production sharepont server,
    1) how to configure alternate access mappings in default zone,internet zone when we create new web application in prod share point server.
    adil

    For internet publishing ifyou want or need change the authentication method you need to EXTEND the website and enable the CLAIM authentication so the user can login using a HTML form for username and password.
    SharePoint make a url parsing to identify the content
    to display so you need to explain all the server name used for contacting the WebApplication. You can use 5 different name for the same server
    (AAM Alternate Access Mapping).
    N.B. http and https are different name (AAM Alternate Access Mapping)Lorenzo
    LSo Lorenzo Soncini Trento TN - Italy

Maybe you are looking for

  • Pdf's display check boxes wrong

    I was able to post this question as it was not asked before. This is incorrect. A thread on this was closed on 2/28/2013 see here... https://support.mozilla.org/en-US/questions/951196 I am presently using FireFox V 23.0.1 When opening up a PDF with p

  • Image size in iBooks Author 'Gallery' when at full page

    Hi I'me looking to make an image gallery (c 40 images)  to fill a complete landscape page in IBAuthor I now need to get the images from the photographers. I was told to request them in the size below but I've just noticed that in the gallery format a

  • Strange digital artifacts at the end of each song importing via iTunes

    I've tried a few variations on archive searches and wasn't able to find an answer to this: In ripping some of my CD's into iTunes (either Apple Lossless or WAV) I've been getting some very odd, brief digital artifacts at the end of each songs on a CD

  • Problems with iTunes shortcut

    I'm having a problem with the iTunes shortcut, I pin it to my taskbar but all I get is this: http://i38.tinypic.com/bdmmhi.png The iTunes shortcut looks like it hasn't been booted, right? But thing is, it has, it's just that the actual iTunes-process

  • Premiere CC 2014 won't open at all!  Help

    I cannot get Premiere to open at all.  Crashes right after the splash screen.  I have never opened the program before.  After a couple of tries, I uninstalled Premiere CC  This came off fine.  Tried reopening Premiere cc2014 again.  No luck.  Still c