Podcast #128: We chat with Kent C Dodds about why he loves React and discuss what life was like in the dark days before Git. Listen now.

Hot answers tagged

15

In order to manage unique permissions for a Securable Object like List or File (via associated List Item) or Folder (via associated List Item) there is a common approach that you could consider: Break role inheritance for a securable object Add/remove the role assignment on the securable object [optional] How to: set unique permissions for a File via REST ...


12

You need to move the list Url to your module definition: <Module Name="Style Library" Url="Style Library" RootWebOnly="true"> for GhostableInLibrary to work properly. You should of course then remove it from the File Url, since it is now defined on module level. If you have no Url in the Module tag you can only use type="Ghostable" on your File ...


11

If I only want to download the stream of the file then the ClientContext object isn't that picky about the website url. The file can be easily downloaded and written to a file. Uri filename = new Uri(@"http://server/sites/site1/subsite/doclib/folder1/folder2/prettyimage.jpg"); string server = filename.AbsoluteUri.Replace(filename.AbsolutePath, ""); ...


10

The error: Additional information: Cannot invoke HTTP DAV request. There is a pending query. is encountered when ClientRuntimeContext.HasPendingRequest property returns true. In case of File.OpenBinaryDirect method you could use the following verification: if (ctx.HasPendingRequest) ctx.ExecuteQuery(); Example private static void DownloadFile(...


9

You probably want this query: /_api/web/getfolderbyserverrelativeurl('<url>')/Files?$expand=ListItemAllFields It will return files properties along with associated list item properties.


8

You need to $select and $expand the AttachmentFiles property for your list items if you want to select many items from the list. _api/lists/getByTitle('MyList')/items?$select=AttachmentFiles,Title&$expand=AttachmentFiles Then you can get attachment info (if it exists) in the AttachmentFiles property of your list item which will be an array of ...


7

The rules are "very simple" (see the full KB article here), which is why you should alway use SPUrlUtility to check filenames. Except about folders and files: Folder names •You cannot use the following characters anywhere in a folder name or a server name: ◦tilde ◦number sign ◦percent ◦ampersand ◦asterisk ◦braces ◦backslash ◦colon ◦...


6

Not enough Reputation to add a comment, but DacrioS has cracked it. I have an on-premises install of Sharepoint 2013 and could not get attachments to show up when using _api/web REST interface. Until I read this comment: "Try adding Attachments to the select." Let me be clear: This Does Not Work _api/web/lists/getbytitle('MYLIST')/items?$filter=Id%20eq%...


6

Make JSlink load your file You can put multiple files in the JSlink where you now use: ~sitecollection\....\yourCSRfile.js They have to be separated by a ; (semi-colon) They do not have to be CSR files, can be any JS file (It is called JSlink for a reason). But they have to be in a location where JSlink may access them: ~site or ~sitecollection (and ...


6

You can use below snippet to include the Powershell Files into your script. 1) If your required files are in the folder, where your main script lies. Then in main script you can write down below snippet to get the Path. $ScriptDirectory = Split-Path -Path $MyInvocation.MyCommand.Definition -Parent So your main script will look something like below. # ...


6

.html and .htm are absolutely identical. In terms of apps there is no difference if you are creating .aspx or .html. But you need to consider your requirements carefully. For example, if you need to host on your page some OOB web parts, for example XSLTListViewWebPart: <WebPartPages:WebPartZone runat="server" FrameType="TitleBarOnly" ID="full" ...


6

What is the file size upload limit for SharePoint online? the File upload limit for SharePoint Online in Office 365 Business Essentials and Office 365 Business Premium is 10 GB per file and file attachment is 250Mb. Note: In classic mode, upload methods other than drag and drop have a 2 GB limit. For more details check Limits for SharePoint Online in ...


5

I would probably host a web service on the SharePoint server that returned the SPWeb.Url using (SPSite site = new SPSite(fileUrl)) { using (SPWeb web = site.OpenWeb()) { return web.Url; } } But if you were going through that much trouble you could build a service to bring back the file info you needed instead of just the site URL. If ...


5

Their are couple of ways to download the documents from SharePoint Document library. Using the Explorer view, you can drag and drop the documents to local directory. UNC mapping to the SharePoint document library and drag/drop documents to a file share. You could refer this blog for details. This is simplest way but it will not display files that exceed the ...


5

If you are asking whether you can leave files in a file share and access them through SharePoint with the out-of-the-box features then the answer is no. There are however, 3rd party solutions out there that you can look at such as the "File Share Library" by Bamboo Solutions or I believe AvePoint also has a solution. On the other hand, if you are asking ...


4

It is still not supported to upload multiple files with managed metadata or simple metadata.


4

The user account that operates the search crawling has to be given read permission to the file share you wish to crawl.


4

Apparently there's a property called FileLeafRef, and I could query the library like so... $.ajax({ url: "site.url/_api/web/lists/getByTitle('LibraryName')/items?$top=1000&$select=FileLeafRef", type: "GET", headers: { "accept": "application/json;odata=verbose" ...


4

expanding on Annchal method you could use explorer view to do this. Time is money, your going to manually create the document library and then write and test the code which could take some time to get it correct as its over three libs on sharepoint. opening the document library in explorer view will make it easy for you to move the whole folder or copy ...


4

If you get a message like: The 'Attachments' column doesn't exists. Try adding 'Attachments' to the select, like: _api/lists/getByTitle('MyList')/items?$select=Attachment,AttachmentFiles,Title&$expand=AttachmentFiles


4

You are probably looking for FileRef property instead of (or in addition to) FileLeafRef property. FileRef property returns server relative file/folder url The following query demonstrates how to retrieve the name and url of every file and folder in Documents library: /_api/web/Lists/GetByTitle('Documents')/Items?$select=FileLeafRef,FileRef


4

You can combine these two by $expanding ListItemAllFields column of the File. ListItemAllFields is __deferred property of File. I believe you know that we need to $expand all Lookup columns and __deferred properties to get information. Anyway, from ListItemAllFields you can get all information what you get from /_api/Lists/GetByTitle('Pages')/Items?$select=...


3

To deploy your file so that SharePoint can access it, you have several options but in your case as it is needed only by your feature event receiver you can deploy it under the feature's root folder. To do so, simply put your file inside a module with a deployment type of "ElementFile". Something like: <?xml version="1.0" encoding="utf-8"?> <...


3

It all depends on the application that downloads/opens the documents. First of all, when you click a document link in SharePoint (via the Browser) SharePoint will send the document back with the correct mime type (assuming it is registered and known). Depending on the settings of the Web Application (strict vs permissive file handling) not default known ...


3

The New Document button should open the template specified on the document library for the user. Then they can save the document back into the library. Upload Document is just that, uploads a doc. If you're seeing Upload for the New, I think this is because you either don't have a template specified for your content type, or you're on a browser that doesn't ...


3

try this: $.ajax({ url: "site/_api/web/GetFolderByServerRelativeUrl('Documents')/Files", method: "GET", headers: { "Accept": "application/json; odata=verbose" }, success: function(data){ //console.log(data); for(var i = 0; i<data.d.results.length; i++){ var result data.d.result[i]; ...


3

No, no OOB settings can prevent a user from overwriting an existing document, unless you do one of the things suggested in the other answers OR you create an event receiver and attach it to your library. In this event receiver, for the itemAdding event handler, you then check if there's another document with the same name and in this case, you cancel the ...


3

Try deleting the items in PowerShell after setting SPWeb.AllowUnsafeUpdates = true; If that doesn't work you may need to create a new list and move the good list items there and then delete your old list using this method. After that you should be able to recreate the list with the same URL as before and move all of the items back.


3

You have multiple ways of uploading a document, depending on where you code is running. Server object model: var context = SPContext.Current; // Get the web reference var web = context.Web; // Get the library reference var docLib = web.Lists.TryGetList("NAME OF THE LIBRARY HERE"); if (docLib == null) { return; } // Add the document. Y asume ...


3

Sounds like the "Open in Explorer" feature is your best bet. Go to the target library, click the "Library" tab, and click "Open in Explorer" (only works in 32 bit IE). This will make the library look like a regular windows folder, from there you can copy and paste files in.


Only top voted, non community-wiki answers of a minimum length are eligible