SharePoint Attachments - sharepoint

Can anyone tell me if its possible to get the date an attachment was uploaded on SharePoint?
I know how to get the links for the attachments using GetAttachmentCollection().
Does SharePoint save the date which the file was added on?
Thanks

Yes, SP saves this information but accessing it is not available in SP client API (WS, CSOM). An attachment is exposed as SPFile by the SP server API, it is retrievable by its web-relative URL by GetFile and you would need one of its properties: TimeLastModified.
Seeing the GetAttachmentsCollection, I guess that you are using WS. You could deploy you custom ASMX or WCF WS to your SP farm providing just the upload time for an attachment URL. You could even create your own alternative of the GetAttachmentsCollection method returning all attachment properties you need in addition to the attachment URL. The former option would minimize the code amount you have to write relying on the OOTB functionality as much as possible, the latter one would give you better performance saving the total client-server call count.
If you cannot deploy a farm solution, services returning JSON or XML can be deployed with a sandboxed solution "concealed" as ASPX pages which would allow you to design such application without involving the farm administrator.

Related

Registering to get the client id and client secret in sharepoint

I am trying to write a program in java to access the SharePoint using SharePoint REST APIs and download the files in a particular folder inside Documents folder. As the first step which is getting the authentication token, I am trying to register the pp using appregnew.aspx form. As I am new in this area, I am not quite sure what would be my App domain and Request uri. Could someone please help me to understand what are these fields for and what value should be filled in these fields?
Thanks
You could know more about registering SharePoint Add-in from here:
https://learn.microsoft.com/en-us/sharepoint/dev/sp-add-ins/register-sharepoint-add-ins

How to retrieve data from SharePoint?

I have a web application. When the user clicks on a button in my web application, I'd like to retrieve data from SharePoint on behalf of the user. I have read quite a few articles on SharePoint but I'm still not sure how to proceed. Should I create a provider hosted SharePoint App and use the SharePointREST API? Thank you in advance for your help.
You don't need to create a Provider to use the SharePoint Rest Services.
Quoting http://msdn.microsoft.com/en-us/library/office/jj164022(v=office.15).aspx :
One advantage of using REST is that you don’t have to add references to any SharePoint 2013 libraries or client assemblies. Instead, you make HTTP requests to the appropriate endpoints to retrieve or update SharePoint entities, such as webs, lists, and list items. See Get started with the SharePoint 2013 REST service for a thorough introduction to the SharePoint 2013 REST interface and its architecture.
Inside the page you will find videos and code examples that will help you to connect and execute operations.
It's Correct. Data in SharePoint is Stored in Lists or Libraries (to files).
You can use the Client Object Model, to get data remotely from a SharePoint Server (on-premise or Online). The Client Object Model can be used through Assemblies (DLL files) or REST services provided by SharePoint. Generally you should know the location of the data you are going to get, that is, as I initially mentioned, the data in SharePoint are stored in Lists or Libraries, therefore you must know the name of the List or Library Additional Site or Sub-site of the List or Library is.
If the name of the list where the information is stored is "employees" and the HR website, the URL could be formed as follows:
http://spserver.company.com/HR/Employees
For REST services, simply complete URL of the list you want to see, so that you retrieve the information from the list. If you want to apply filters, sorting, to retrieve specific columns, you must do it through CAML queries which the add on REST service call.

Sharepoint Online DocumentSharing API

trying to share a file with external users via the API, our in-house app will upload the file to sharepoint, return the view only link and we can then send that link to external users avoiding emails etc.
Is this possible with .NET C#?
Yes, it is possible. with the SharePoint client object model, your application can: Upload the document to the document list, and set the permission for that item, then return the link to external user.

Sharepoint: get number of sites in a collection

I'm trying to get the total count of subsites created in a very large Sharepoint collection. Please note, I don't have direct access to the server.
Is there any native sharepoint feature I'm missing that will provide a site count?
Is there a webservice that can crawl the collection? (we have google analitics)
Are there any other options short of running a powershell script on the server?
Thanks!
I would suggest using the 'Webs' Web Service - you can invoke it by putting /_vti_bin/webs.asmx on the end of your site URL. It has a method GetAllSubWebCollection.
The only gotcha is that you will get filtered results based on the user being used to access the web service. For example, if you have a site collection that has a sub-web created for HR, Business, Management, Sales and IT - but your account only has access to the HR and Sales site - you will only get results back for the HR and Sales sites.
You may also find the SPServices jQuery library helpful as it has wrappers for most of the web services and can make calling them from a client much less painful.
Note: These web services exist for the 2007 and 2010 editions of SharePoint. You didn't mention a specific version but hopefully it is one of these two.

How to make url for a document in document library publicly accessible?

I have Sharepoint 2010 hosted with windows authentication . I have created a document library inside a new site and uploaded few files.
Now,I'm trying to utilize the info of these files in some application using Rest Webservice exposed by sharepoint.
*http://{server_name}/{site}/_vti_bin/ListData.svc/{Document_Library_name}*
In the response I get xml containing details of files uploaded in document library. One of the tag in response of xml (inside src attribute of tag) contains detail of url of file uploaded,
Now when I try to use this url for document display/download in my application/browser, it pops up with the window authentication which I have for Sharepoint site . After I provide correct user/password the document gets downloaded.
Is it somehow possible to make this document url public(I don't want window authentication pop up) ? At the same time I don't want to disable the Windows authentication for Sharepoint site .
Thanks in advance
By public do you mean accessible within your LAN or accessible from the internet given the sharepoint site is bound to an internet facing interface? I would imagine on the LAN it would be best to simply use the guest account for users who you wanted to give 'public' access to.
Bear in mind the only reason you're prompted for login details is probably because you're not using Internet Explorer.

Resources