Hot answers tagged file
4
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 ...
3
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"?>
...
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.
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
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
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
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
When you edit a file in SPD, the file automatically becomes "Unghosted".
This (rather confusing) term means that the file has been "Customized".
The effects of this depends on what type of file you are editing.
For example, if you are editing a Page Layout, the code that's added will literally break the page, since the content added will not be wrapped ...
1
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.
Only top voted, non community-wiki answers of a minimum length are eligible



