Tag Info

Hot answers tagged

6

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

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

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


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


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

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

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

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


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


1

If your site uses Anonymous access, this could be the issue as the Anonyous ID is not included in 'Everyone'. You might need to wrap your code in the RunWithElevatedPrivileges() command so that it runs under the ID of the application pool SPSecurity.RunWithElevatedPrivileges(delegate() { using (SPSite site = new SPSite("siteUrlOrID")) { using (SPWeb ...


1

You can make use of CAML query to fetch the values as below, var caml = "<View><ViewFields><FieldRef Name='Title'/></ViewFields></View> Or you can make use of $().SPServices Have a look at the below link, Get List items using Jquery


1

The SP Object Model does not support adding files pragmatically to SharePoint under Ghostable/GhostableInLibrary mode, therefore reflection is needed. I found a good article with a code example: http://erickhaw.blogspot.co.il/2012/02/create-pageitem-in-ghosted-mode.html


1

You're not alone ! This is related to Internet Explorer 9 (and 10) handling of MHT files. While you can open them when they are saved locally, you can't run them anymore like other content types with the default settings. Ensure that .mht are associated with IE, then check that the site is in the trusted zone (or intranet) and security settings are set to ...


1

Once you set the Browser File Handling to Permissive for the web application. After that Go to SharePoint Document Library --> Library Settings --> Advanced Settings change setting. (As like Above image)


1

In my experience SharePoint is useful for Document Management for large companies because of its metadata tagging abilities. If you don't have thousands of files with different permissions required for them all, then I'd say it's probably better to just go with a fileshare. SharePoint takes a lot of resources to run and can be a pain to maintain. Some other ...


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

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

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


1

Have you looked at Site Collection Auditing? http://office.microsoft.com/en-us/sharepoint-server-help/configure-audit-settings-for-a-site-collection-HA102031737.aspx You can use the audit feature of Microsoft SharePoint Server 2010 to track which users have taken what actions on the sites, content types, lists, libraries, list items, and library files ...


1

I know this question was asked a while ago now, but for anyone else with a similar problem, I would personally avoid using the site template approach. Perhaps a better solution (IMO) would be to create a separate site-scoped feature as suggested by Ted N.. The Web App scoped feature would still create the new site but could also activate any site-scoped ...


1

check this link out on msdn forum as its the same question: For the ones (.docx / .xlsx) if you add metadata; you download the document and upload it back again you will notice the field values will be pre-populated and this is because of XML promotion and demotion. To verify this: Step 1: change the extension of your .docx or .xlsx to .zip ...


1

I used managed CSOM to complete the same task before. You can find the code at http://wp.me/p23FqP-1U. I am not good at JavaScript. Hopefully you can work out the JavaScript from my C# code. Here is my C# code public void CopySharePointDocument(string siteUrl, string srcUrl, string desinationUrl) { var relativeSrcUrl = ...



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