Tag Info

Hot answers tagged

7

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 ...


4

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


4

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 ...


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

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

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 ...


2

I think using PowerShell script with windows sheduler is very usefull way. UPD. Question was interesting to me and i solved it. $web = Get-SPWeb http://sharepoint $spFile = $web.GetFile("/Documents/folder/document.docx") $target = "\\networkshare\document.docx" [System.IO.File]::WriteAllBytes($target,$spFile.OpenBinary())


2

You can add this file to the mapping folder Layouts for example, even add this file to embeded resources of receiver's assembly, if you don't need to share this xml with other modules. When you will add file to the mapping folder Layout, to get it, use path a kind of http://hostname/_layouts/your_file_name.xml this path will be accessible on any web, becouse ...


2

You can use file = web.GetFile("URL"); to get the file object. Then you can loop using ParentFolder until you reach the root folder of the document library and count the depth. SPWeb.GetFiler SPFolder Kind regards Stefan


2

You can't use only JavaScript to do this. The CopyIntoItems method takes a byte[] stream parameter. This means you need to be able to read a file into a byte array and then pass this to the method. This first step isn't possible in JavaScript.


2

I'd say to use folders with unique permissions on the folders where needed but then in your views, choose to show items without folders. This will security trim everything so users still only have access to what they need but you won't run into performance problems with item level permissions. The files in the folder inherit permissions from the folder, ...


2

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 ...


2

This is totally normal when working with Client Object Model (CSOM). All operations are batched and not performed until you fire them away using ExecuteQuery() or ExecuteQueryAsync(). The rest of your code is just setting of local properties, which is converted into an XML format, which is sent to SharePoint at the time you execute the ExecuteQuery method.


2

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, ""); string ...


2

as per my knowledge you have to upload a template document with content type and metadata mapping. so u can update the document. because document is generated based on your template. below couple of links which helps you.. http://somnathmatere.blogspot.in/2011/05/how-to-programmatically-upload-document.html ...


2

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


2

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" ...


2

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]; ...


2

On upload there is a checkbox "Overwrite current version" (or similar). This is the only setting there is. The main problem is that this option is not given if the user drag-and-drops documents to a library view!


2

If users have "Contribute" permission only and if document library sets to display only users own documents, they can not overwrite documents of eachother. If they try to save a document with same name, it will give a "Permission Denied" error.


2

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.


2

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 ...


1

The easiest way would be to use Web.GetFileByServerRelativeUrl See msdn


1

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 ...


1

Based on your code I am assuming this is Sharepoint 2010..... Content types have various levels such as: Library, web, and site. All ContentTypes eventually roll up to the item content type at the Site Collection Level. This means that if you iterate through the parents until you get to the Site level you SHOULD find an ID within your dump. Since you are ...


1

Actually, I feel little dumb. I had to go to site collection settings and only pick the scope i wanted that site to use. Then my fileExtension=aspx exclusion rule worked.


1

http://prajapati-jatin.blogspot.com/2011/10/exclude-allitemsaspx-pages-from.html This should have directions to exclude any .aspx file from search results


1

According to MSDN property maxRequestLength Specifies the limit for the input stream buffering threshold, in KB. This limit can be used to prevent denial of service attacks that are caused, for example, by users posting large files to the server. By default for SharePoint 2010 it value is set to 50 MB: <httpRuntime maxRequestLength="51200" ...


1

No, you cannot have SPFile pointing to an external location. What you could do is to add a redirect (.aspx) or link file (.lnk) that takes you to the file on the external location.


1

By default, FileStream needs ReadWrite access that’s why System.UnauthorizedAccessException is thrown because on a production machine, User account under which asp.net worker process runs or a windows service or for that matter any process will not have the write access to a file by default. Please make sure you get the reference to any web is constructed ...



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