See document in list without opening it in SP2010 - c#

is it possible in Sharepoint 2010 set a permission on a document in order to allow a specific user to view this document (when viewing the documents of a specific document library for example) without giving him the privilege to open it?
For example, [user1] can see that in the list of documents of document library [DocLib1] there is a document called [doc1.docx], but [user1] doesn't have the permission to open[doc1.docx] and view its content.

Technically raymund's answer is obscurity instead of security. If you are going to go that route you can simply update your primary view to remove any links to the document. and create a seperate view for those authorized.
Edit***
after double checking msdn, I found the user permissions article. This shows that there are in deed two seperate permission levels - view items and open items. unfortunately view items is dependent upon the open items permission level, therefore unable to really accomplish your goal.
http://technet.microsoft.com/en-us/library/cc288074.aspx

You can do this by creating a SOAP Service Connection in Sharepoint Designer
Then using your Document List as the source (declaring a login on the login tab with a privilage to tread the list) , then displaying it as a dataview in a sharpoint form.
I have a similar sample here which has a better explanation using a list instead (I should work the same with document library as they are exposed both as lists).

Related

How to retrieve SharePoint Share Links using CSOM

I am currently developing a program that will upload selected files to a specific folder (and create the folders automatically if necessary) on SharePoint and give access to specific users based on their emails using SharePoint CSOM, however I am unable to retrieve the links for people outside of my domain.
For example, with my current code, I am retrieving links like the following:
https://domain.sharepoint.com/:f:/r/sites/TestSite/Shared%20Documents/2019/11157/Test%20Upload?csf=1
However, the link I am trying to retrieve is like the following:
https://domain.sharepoint.com/:f:/s/TestSite/EmUDng-KzwxEtHKyJ9Okl0MBlS_z8gxGFl4UUjuGXHmR9w
I can retrieve the link above if I go into SharePoint and manually retrieve it (the program makes the links correctly), but that defeats the purpose of my program. The program is supposed to automate the upload and link retrieval of files from within my company's domain.
I do not want the first link because only people who are within my domain can access the file/folder with it. The 2nd link allows for anyone who has been given access (via an email address) to access the file/folder.
I am currently retrieving the first link by using the code from here: https://www.c-sharpcorner.com/article/generating-sharing-links-report-and-removing-sharing-links-using-sharepoint-onli/
I have also tried other suggestions I have found on StackExchange such as: https://sharepoint.stackexchange.com/questions/91451/manage-links-for-shared-files
All examples I have found like the above all result in the incorrect links.
In case it is not clear currently, I am not after an anonymous link or how to create shared links (as I already have this working), I am after the link that would appear here
I managed to find the solution after just randomly trying everything. What you can do is as follows:
First, create the sharing link in the way I was previously:
SharingResult result = context.Web.ShareDocument(site,
email,
ExternalSharingDocumentOption.View,
false,
"Document Shared as test");
Then with the result variable, grab the invitation link of one of the invited users and then modify it to work for any user (as it turns out, specific links are the same for all users other than a parameter on the end)
string link = result.InvitedUsers.FirstOrDefault().
int index = link.IndexOf("?");
if (index > 0) link = link.Substring(0, index);
This results in the correct link I was looking for. I did speak to some people from Microsoft asking about this, so, thanks Microsoft for telling me this was impossible!

Unable to read mails of nsf file programatically

Am trying to programatically read mails of nsf file using c#.
But iam not able to get the views.
following are the code that i have used to get views
_InboxView = _serverDatabase.GetView("($Inbox)");
My nsf file template is totally different.
Why am not able to get the views? please suggest.
The line of code you posted takes the database (did you check, if _serverDatabase is initialized, by the way?) and tries to open a folder or view with the programmatic name "($Inbox)". In your template that name could really be everything.
You either need to ask the developer of the app for the name of that folder / view (they are not different for access via the NotesView- Class), or you need to find it out by yourself.
To find it out, you could use the Notes client menu: Try View - Go To... and identify the name of the View that is shown in your screenshot. If your view looks "hierarchical" (you need to click a plus to find it), then compose the viewname from the complete tree using backslashes, e.g. "All Views\Your Special view".
It may be easier to find out the name of the view, if you have Domino Designer installed and have enough rights to open the database in designer: There you can simply find the view in the views section or a folder in the folders section and copy the name or the alias of it (both are equally valid).

AssetUrlSelector toolpart

What I need to do is quite simple although is causing me lots of trouble.
I need to create programmatically an AssetUrlSelector in a web part that selects a file in sharepoint 2010 and makes its path available to be used elsewhere.
So far I have managed to create the AssetUrlSelector and display the path on a textbox, however I cannot use this as every reference to it will be null.
Have you got any practical example?
Try the Document ID Service. In short this service generates IDs for documents (files) and generates an url with this ID so even if the file is moved the url stays valid and the service returns the document. This service might rely on search functionality unless you implement your custom search. Here is an article on how to configure OOB Doc IDs here. Also you can google further if you're interested.

SharePoint most clicked links

I am trying to make a web part that will display what links got clicked/viewed the most across the whole site collection. These links come from a SharePoint list.
Is there a mechanism in the object model that can be used to accomplish this?
Any thought would be helpful.
If the links all go to SharePoint pages within your portal, then you might be able to gather the information in your Site Usage Report, then query that in a custom web part. If the links point to places outside your portal, I am not aware of any out-of-the-box record of which links are getting clicked on in a SharePoint list. You could possibly make some javascript to add special code to the list interface so that, whenever a link is clicked, it first records to a database, then takes the user to the destination.

How to force a WebPart appears in all pages of a portal in asp.net?

I'm working on a portal/CMS project and (unfortunately) build the foundation on WebParts platform.
However I need to provide an option for admin to choose whether a webpart should be display in all pages or not. Finally I've found a nice article from Damon Armstrong that describes a way to store all personalization data of a group of pages into one record. Thus every changes the admin made for a webpart, affect whole pages.
But it doesn't seems to be a solution for me because of these reasons:
1- The above solution works for a group of pages; in fact we can select which pages to display all webparts, but we expect reverse: select which webpart to display in all pages.
2- After some data entry and adding webparts on pages, we'll face an issue about massive data size of personalization record that should be serialize and deserialize to display contents of each page.
May be it would be solved by writing another custom personalization provider or some hacking on webparts system, but I don't now how.
Any Ideas about the problem?
Thanks
Could you use a master page that always loads certain web parts into a particular zone, and which prevents the user from removing them from the zone?

Categories