Adding file in SharePoint document Library using sandbox solution
Why I am Missing Uploaded File name In Post back & am unable to add debugger give me solution thanks in advance
Below is my sample code
protected void btnsubmit_Click1(object sender, EventArgs e)
try
//upload Image
web.AllowUnsafeUpdates = true;
Boolean replaceexistingfile = true;
if (Filephoto.HasFile)
Stream fStream = Filephoto.PostedFile.InputStream;
byte[] contents = new byte[fStream.Length];
fStream.Read(contents, 0, (int)fStream.Length);
fStream.Close();
string FileName = Filephoto.FileName;
string destUrl = SPContext.Current.Web.Url + DocumentLibName + FileName;
web.Files.Add(destUrl, contents, replaceexistingfile);
SPFile file = web.Lists[DocumentLibName].RootFolder.Files.Add(FileName, contents, replaceexistingfile);
lblliteral.Text = file.ToString();
SPFieldLookupValue value = new SPFieldLookupValue(listitem.ID, listitem["EmployeeCode"].ToString());
file.Item["EmployeeCode"] = value.ToString();
file.Item.Update();
else
//throw new FileNotFoundException("File Not Found");
string FileName = "nofile";
lblliteral.Text = FileName + "filepload" + FilePassport.FileName + " : " + FilePan.FileName;
web.AllowUnsafeUpdates = false;
catch (Exception ex)
// Page.Response.Write(ex.Message);
string FileName = ex.Message;
lblliteral.Text = FileName;
Hi,
We can put into the Session, the code snippet for your reference:
//If first time page is submitted and we have file in FileUpload control but not in session
// Store the values to SEssion Object
if (Session["FileUpload1"] == null && FileUpload1.HasFile)
Session["FileUpload1"] = FileUpload1;
Label1.Text = FileUpload1.FileName;
// Next time submit and Session has values but FileUpload is Blank
// Return the values from session to FileUpload
else if (Session["FileUpload1"] != null && (! FileUpload1.HasFile))
FileUpload1 = (FileUpload) Session["FileUpload1"];
Label1.Text = FileUpload1.FileName;
// Now there could be another sictution when Session has File but user want to change the file
// In this case we have to change the file in session object
else if (FileUpload1.HasFile)
Session["FileUpload1"] = FileUpload1;
Label1.Text = FileUpload1.FileName;
More information about the similar issue:
http://www.codeproject.com/Tips/101834/How-to-Maintain-FileUpload-Control-s-State-after-P
If you want to upload file into document library, here is another option for your reference:
http://purtuga.github.io/SPWidgets/
Best Regards
Dennis Guo
TechNet Community Support
Similar Messages
-
Download older version of a file from SharePoint Document Library using CSOM and 404 error
Hi,
I am trying to download previous versions including Major and Minor versions of documents from SharePoint Online using CSOM. I get 404 error when I try to download the file. I found several posts on various discussion forums where people are getting same
error but none of those have any solution/answer. Below is one of the threads and sample code I have tried that results in 404 error. If I use the link in browser directly, I am able to download the file. Also I am able to download the current version of file
using CSOM without any problem, it is only the older versions that give me 404 in CSOM.
http://qandasys.info/how-to-download-the-historical-file-version-content-using-csom/
public int GetStreamFromFile(string docid, string lib, string fileurl, ClientContext clientContext, int iuserid, string Version, bool isCurrrent)
if(!isCurrent)
List LibraryName = clientContext.Web.Lists.GetByTitle(lib);
clientContext.Load(LibraryName);
clientContext.ExecuteQuery();
CamlQuery camlQuery = new CamlQuery();
camlQuery.ViewXml = "" + fileurl +
Microsoft.SharePoint.Client.ListItemCollection collListItem = LibraryName.GetItems(camlQuery);
clientContext.Load(collListItem, items => items.Include(item => item.Id, item => item["FileLeafRef"], item => item["LinkFilename"],
item => item["FileRef"], item => item["File_x0020_Size"], item => item["DocIcon"], item => item.File.Versions));
//clientContext.Load(collListItem);
clientContext.ExecuteQuery();
foreach (Microsoft.SharePoint.Client.ListItem oListItem in collListItem)
//string fileurl1 = (string)oListItem["FileRef"];
//string filename = (string)oListItem["LinkFilename"];
foreach (FileVersion version in oListItem.File.Versions)
if (Version == version.VersionLabel)
//Added excutequery to get object one more time as per blog
//http://social.technet.microsoft.com/Forums/de-DE/sharepointdevelopmentprevious/thread/88a05256-8694-4e40-863d-6c77512e079b
clientContext.ExecuteQuery();
FileInformation fileInformation = ClientOM.File.OpenBinaryDirect(clientContext,version.Url);
bytesarr = ReadFully(fileInformation.Stream);
DarwaishHi,
According to your description,
I know you want to get older version of a file from SharePoint Document Library using Client Object Model.
The following code snippet for your reference:
public void GetVersions()
ClientContext clientContext = new ClientContext(“http://SPSite”);
Web site = clientContext.Web;
clientContext.Load(site);
clientContext.ExecuteQuery();
File file = site.GetFileByServerRelativeUrl(“/Shared Documents/mydocument.doc”);
clientContext.Load(file);
clientContext.ExecuteQuery();
ListItem currentItem = file.ListItemAllFields;
clientContext.Load(currentItem);
clientContext.ExecuteQuery();
FileVersionCollection versions = file.Versions;
clientContext.Load(versions);
clientContext.ExecuteQuery();
if (versions != null)
foreach(FileVersion _version in versions)
Console.WriteLine(“Version : {0}”,_version.VersionLabel);
More information:
http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.client.file.versions.aspx
Best Regards,
Dennis Guo -
Adding attachment to SharePoint Document Library- Is it possible?
I would like to know if it possible to attach a file to a document library items like one would to a List item.
I have read some postings on this very issue but most are a couple years old. Would like to know if updated technology has possibly solved
this issue. I am using SharePoint 2013 Enterprise edition.
I am new to SharePoint
Thank youNo its not. The real difference between a list item and a library item is that a library item is required to have one and only one file attachment and that attachment is the focus of the library. Lists can have multiple file attachments on each
list item and the focus is the metadata not the attachment.
Depending on what you are trying to do take a look at Document Sets. Its a collection of documents that can share metadata.
http://technet.microsoft.com/en-us/library/ff603637.aspx
Paul Stork SharePoint Server MVP
Principal Architect: Blue Chip Consulting Group
Blog: http://dontpapanic.com/blog
Twitter: Follow @pstork
Please remember to mark your question as "answered" if this solves your problem. -
C#/REST Getting files in a document library using Internal Name
Hi Folks,
I need to get a list of files in a SP2010 and SP2013 document library using the REST API - this is occurring inside a timer service application so am using C#. As a constraint I need to use the internal names for the document libraries - primarily
because users tend to change the display name and this is an automated service.
When I make a call to _api/web/GetFolderByServerRealitveUrl('/Shared Documents')/Files I get a bunch of XML but how do I get just a list of filename+ext. I am using Xdocument (LINQ to XML). I need to retrieve the name property in the
contents sub element for all files returned.
Second question, how to I change this to use the internal name '/Document' instead of '/Shared Document', so that it copes with users changing the display name of document libraries.
Regards
AndyHi Andy,
1.For your issue, you can refer to the code as below:
using System.Xml;
namespace REST_XML_LIST_GET
class Program
static XmlNamespaceManager xmlnspm = new XmlNamespaceManager(new NameTable());
static Uri sharepointUrl = new Uri("Site URL/");
static void Main(string[] args)
xmlnspm.AddNamespace("atom", "http://www.w3.org/2005/Atom");
xmlnspm.AddNamespace("d", "http://schemas.microsoft.com/ado/2007/08/dataservices");
xmlnspm.AddNamespace("m", "http://schemas.microsoft.com/ado/2007/08/dataservices/metadata");
NetworkCredential cred = new System.Net.NetworkCredential("username", password", "domain");
HttpWebRequest listRequest = (HttpWebRequest)HttpWebRequest.Create(sharepointUrl.ToString() + "_api/Web/lists/getByTitle('List Name')/items");
listRequest.Method = "GET";
listRequest.Accept = "application/atom+xml";
listRequest.ContentType = "application/atom+xml;type=entry";
listRequest.Credentials = cred;
HttpWebResponse listResponse = (HttpWebResponse)listRequest.GetResponse();
StreamReader listReader = new StreamReader(listResponse.GetResponseStream());
var listXml = new XmlDocument();
listXml.LoadXml(listReader.ReadToEnd());
//Method 1 Seperate node list
var titleList = listXml.SelectNodes("//atom:entry/atom:content/m:properties/d:Title", xmlnspm);
var idList = listXml.SelectNodes("//atom:entry/atom:content/m:properties/d:ID", xmlnspm);
int i = 0;
foreach (XmlNode title in titleList)
Console.WriteLine(title.InnerXml+" "+idList[i++].InnerXml);
//Method 2 single node list
var prop = listXml.SelectNodes("//atom:entry/atom:content/m:properties", xmlnspm);
foreach (XmlNode ndlist in prop)
Console.WriteLine(ndlist.SelectSingleNode("d:Title", xmlnspm).InnerXml + " " + ndlist.SelectSingleNode("d:ID", xmlnspm).InnerXml);
Console.ReadLine();
2. For a workaround, you can get the display name based on the internal name and use the display name in the Rest API.
Reference:
http://www.c-sharpcorner.com/UploadFile/Roji.Joy/working-with-sharepoint-2013-rest-api-in-a-C-Sharp-managed-code/
https://dlr2008.wordpress.com/2013/11/14/sharepoint-2013-rest-api-the-c-connection-part-4-document-libraries-folders-and-files/
Thanks,
Eric
Forum Support
Please remember to mark the replies as answers if they help and unmark them if they provide no help. If you have feedback for TechNet Subscriber Support, contact
[email protected].
Eric Tao
TechNet Community Support -
I have been asked to see if it would be possible to get exchange emails downloaded and or sent to a document library .
I know of the sitemail box app. but we are not running Exchange 2013.
and setting up the lists and or document library to receive emails using the built in doesn't seem to be working...( maybe not configured correctly, i would need to see what the prior admin/developer did)
But is there a way to get the emails downloaded to a document library using a workflow and or a powershell script that is triggered via workflow?Hi,
Since workflow can only work on items in SharePoint sites, they cannot get Exchange emails, let alone download emails to SharePoint library. However, you could manually save email to local and upload it to SharePoint list/library.
I'd suggest you toubleshooting the incoming email settings in SharePoint. Please refer to the article below and check your configuration:
https://technet.microsoft.com/en-us/library/cc262947.aspx
http://blogs.technet.com/b/harmeetw/archive/2012/12/29/sharepoint-2013-configure-incoming-emails-with-exchange-server-2013.aspx
Regards,
Rebecca Tu
TechNet Community Support
Please remember to mark the replies as answers if they help, and unmark the answers if they provide no help. If you have feedback for TechNet Support, contact
[email protected] -
How to create a 'Link to a Document' Item in a SharePoint Document Library using power shell?
Hi,
I have a document library with "Link to a document" content type. And, I have to add some links into that library using powershell. I have searched enough regarding approachs for adding a link into the library in powershell but i did not get anything yet.
Please provide some approaches and code samples to solve this problem.
Thanks,
Lalit Kumar MishraAdding Site Columns To Content Types Using PowerShell
Adding Site Columns To Content Types Using PowerShell
The below PowerShell script will allow you to add a metadata field that is either contained at the Site Collection level, Site level, or library level, to the specified Content Type.
It also contains some optional lines that you might choose to include or exclude, such as
Setting the visibility of the column in the edit form to hidden
Setting the status of the column to require values
01
function Add-SPContentTypeField
02
03
<#
04
.Synopsis
05
This function will allow you to add a library field to a Content
Type
06
.Description
07
This function will add the nominated site column/ library column to a nominated Content
Type within all of the 'Document Libraries'
in the given Site Collection
08
.Example
09
C:\PS>Add-SPContentTypeField
–SiteUrl “http://yourdomain.com/sites/Finance –FieldName
"myField" -CTypeAddedTo "myContentType"
10
.Notes
11
Name: Add-SPContentTypeField
12
Author: Petro Margaritis
13
Last Edit: 19/07/2012
14
Keywords: Fields, Site Columns, Content Types
15
.Link
16
http://thesharepointproject.com/
17
#>
18
19
Param (
20
[parameter(Mandatory=$true)][string]$SiteUrl,
21
[parameter(Mandatory=$true)][string]$FieldName,
22
[parameter(Mandatory=$true)][string]$CTypeAddedTo
23
24
25
$site = Get-SPSite
$SiteUrl
26
27
# Walk through each site in the site collection
28
$site | Get-SPWeb
-Limit all | ForEach-Object {
29
30
write-host
"Checking site:"$_.Title -Foregroundcolor
Green
31
32
# Go through each document library in the site
33
foreach
($list in $_.Lists | where
{ $_.BaseTemplate -eq "DocumentLibrary" })
34
35
36
# Check to see if the library contains the content type we are looking for
37
if (($list.ContentTypes |
where { $_.Name -eq $CTypeAddedTo
}) -eq $null)
38
39
Write-Host
"The Content:" $CTypeAddedTo "does not exist in the library:"
$list.Title -Foregroundcolor Red
40
41
else
42
43
# Check to see if the library contains the field we are looking for
44
if (($list.Fields |
where { $_.Title -eq $FieldName
}) -ne $null)
45
46
# Get the content type you want to add the field to
47
$ct
= $list.ContentTypes[$CTypeAddedTo]
48
# Get the column you want to copy
49
$field
= $list.Fields[$FieldName]
50
# Add the column to the content type
51
$ct.Fieldlinks.Add($field)
52
$ct.update()
53
54
# Add additional column settings
55
$ctFieldLinks
= $ct.FieldLinks | Where
{$_.Name -eq $field.Title}
56
# OPTIONAL: This will set the column to hidden so that it is not viewable in the edit form
57
$ctFieldLinks.Hidden =
$true
58
# Set Field to require value
59
$ctFieldLinks.Required =
$true
60
$ct.Update()
61
Write-Host
"The Field:" $field.Title "has been successfully added to the library:"
$list.Title -Foregroundcolor Cyan
62
63
else
64
65
Write-Host
"The Field:" $FieldName "does not exist in the library:"
$list.Title -Foregroundcolor Yellow
66
67
68
69
70
# Dispose of the site object
71
$site.Dispose()
72
Simply copy and paste the above into Notepad and save it as a PowerShell file with the name
Add-SPContentTypeField.ps1
view sourceprint?
1
# To run the above function you'll need to do the following - go into the saved location
2
Cd C:\scripts\
3
# Then call it using the dot prefix - note that there is a space between the dots, ..\
4
. .\Add-SPContentTypeField.ps1
5
# Now we can happily run the script like so
6
Add-SPContentTypeField –SiteUrl “http://yourdomain.com/sites/Finance –FieldName
"myField" -CTypeAddedTo "myContentType" -
How to filter the Files from SharePoint Document Library based upon cloumn value
Hi
I should filter the files from document library. I have column called "Print Status" for the document library the value would be either "Yes" or "No".
Now i should filter out the files which has "Print Status" as a "Yes".
I am using SPFolder and SPFile from SharePoint Object Model to traverse the file in doc library.
How could i do it?
My Sample code:
foreach (SPFolder childFolder in folder.SubFolders)
if (childFolder.Name != "Forms")
AspControls.TreeNode trn = new System.Web.UI.WebControls.TreeNode(childFolder.Name, "", "~/_layouts/images/itdl.gif", childFolder.ServerRelativeUrl.ToString(), "");
newNode = TraverseFiles(childFolder, trn);
// add the new node to the tree
rootNode.ChildNodes.Add(newNode);
// loop through the files
foreach (SPFile childFile in folder.Files)
// create a new node and add to the tree
AspControls.TreeNode childNode = new System.Web.UI.WebControls.TreeNode(childFile.Name + " (" + childFile.TimeLastModified.ToShortDateString()
+ ")", Convert.ToString(childFile.Item["ID"]), "~/_layouts/images/" + childFile.IconUrl, childFile.ServerRelativeUrl.ToString(), "");
rootNode.ChildNodes.Add(childNode);
Thanks
Poomani Sankaran.Why do you transvers the file an not use a camp query? In a CAML query you can filter the print status and are able to get all files and folder objects at once.
Check out the following post: http://social.msdn.microsoft.com/Forums/sharepoint/en-US/8c45b5e2-1fb8-435c-a97d-1d8c6d288d4c/caml-query-to-query-all-the-files-and-folders-in-document-library?forum=sharepointdevelopmentprevious
Kind regards
Stefan
http://www.n8d.at/blog
Follow me on Twitter: StFBauer |
n8design
Microsoft Community Contributor 2011 / 2012
MCTS - SharePoint / WSS Configuration and Development -
Edit CSV files present in document library using Microsoft Excel
Hi all
I have a document library with CSV files uploaded. I have used the below mapping in DOCICON.xml present in \14\TEMPLATE\XML folder.
<Mapping Key="csv" Value="csv16.gif" EditText="Microsoft Excel" OpenControl="SharePoint.OpenDocuments"/>
And I modified mime type with "application/vnd.ms-excel" for csv in IIS7. Now, when i click on the file popup is getting displayed with 2 Radio Buttons.
1) Read Only
2)Edit
When i select "Read Only", the file is opening in Microsoft Excel in readonly mode But when i select "Edit", the file is opening in Note pad and its editable.
Now, My requirement is to edit the csv file in Microsoft Excel not in NotPad.
Can Any one help me to acheive this!! Thanks in advance.Try below:
http://nickgrattan.wordpress.com/2011/01/05/sharepoint-opening-csv-files-with-microsoft-excel/
Run the “Internet Information Services (IIS) Manager” application from the Start/Administrative tools menu.
Select the server in the left-hand pane.
Select “MIME Types” in the list of options in the middle pane.
Then locate the .CSV entry (it should already exist) and change the MIME type to: application/vnd.ms-excel, and click
OK. -
How to: Redirect after document adding to a sharepoint document library
i need to redirect the current user to a custom url after successfully uploading a document.
the user clicks "+ new document" in the document library
the user selects a local document
the document gets uploaded and in that moment after it is successfully uploaded and the item is created in the list, i want to redirect the user to a custom url
Normally after successfully uploading a document to a document library under SharePoint 2010, the user gets a modal dialog where he sees only the field "Name" with the filename.
I want to prevent this. How could i achieve this?
best regards
YavuzThanks for the replies, but that is not i was searching for.
For example:
the user clicks "+ new document" in the document library
the user selects a local document
the document gets uploaded and in that moment after it is successfully uploaded and the item is created in the list, i want to redirect the user to a custom url. On my system i get the Edit.aspx form ->
i don't want this!!
Normally after successfully uploading a document to a document library under SharePoint 2010, the user gets a modal dialog where he sees only the field "Name" with the filename.
I would like to do this inside an eventreceiver.
After the document is successfully added to the library i would like to redirect the user directly to another page.
I hope this clearifies my problem :) -
Issues opening PDF files from SharePoint document library reader/pro 11.0.5
Hello,
We have a sharepoint 2010 enviroment and recently upgraded our Acrobat X11 installs ( both reader/std/pro) to version 11.0.5.
We have a mixture of WIndows 7 32/64Bit IE 8 and IE 9 machines
After upgrading to 11.0.5 when users click a pdf file in a SP document libary one of two things happens depending if they have the
Adobe Reader Plugin Enabled or not
If the Adobe Reader Plugin is enabled, they will not get prompted to run/save the pdf file and it will not open in a new tab in the browser
If the Adobe Reader Plugin is disabled, they will get a popup window that has the correct URL to the PDF in the address bar but they will not be prompted to save or run the file.
If they click in the addrss bar and press enter the pdf will then load in the external reader/acrobat application.
This issue started with 11.0.5 updates, rolling people back to 11.0.4 fixes the issue.
I have attempted everything I can think of including rebuilding new machines with our image.
Has anyone see issues like this with the 11.0.5 update?If a bug is confirmed, a fix may be delivered in the next release (can't promise). For a similar issue caused by a Microsoft bug, see http://forums.adobe.com/message/6106294#6106294.
Ben -
Hi,
I have a scenario, where I need to upload files from a Unix system to SharePoint document library. How can this be achieved using SharePoint Web Services (REST endpoint or any other endpoint that can be consumed in other scripting technologies) and not the
SharePoint object model?
Thanks,Hi,
According to your post, my understanding is that you want to upload the files from the Unix system to SharePoint document library.
We can install File Transfer Protocol (FTP) in Unix system. In a client machine, we can create a Console Application using Visual Studio, then use C# to get the
file in FTP server, then add the files to SharePoint document library using SharePoint Client Object Model or REST APIs.
If you need to scheduled uploading, we can create a Windows Job to achieve it.
The following articles for your reference:
http://kumarprashanth.blogspot.com/2010/06/reading-unix-file-using-cnet.html
http://blogs.msdn.com/b/sridhara/archive/2010/03/12/uploading-files-using-client-object-model-in-sharepoint-2010.aspx
Best regards
Dennis Guo
TechNet Community Support -
Unable to edit .vsdx visio file that is inside a document library using visio 2010 sp2
I have Visio 2010 SP2 installed locally inside my machine. The current version can open vsdx files by doing some conversions. I got the following scenario inside my SharePoint server 2013:-
Currently I have Visio file (with .vsdx extension) uploaded to my SharePoint 2013 document library.
If I click on the Visio file I got the following dialog.
I select “Edit”, click on ok.
Then the visio 2010 application will convert the current file and open it locally inside my machine.
But the opened file will have it name as “Copy (1) of ….”, as follow:-
So if I do some changes to the Visio file and I click on save I will not be able to save my changes back to the SharePoint server’s document library. Now if I do the same steps for a .vsd file not .vsdx then I can directly open the Visio file (without any
conversion process) and I will be able to save my changes back to SharePoint server.
So can anyone advice how to be able to edit .vsdx files which are uploaded to SharePoint document library using visio 2010 SP2 ?
ThanksThank you for your ideas.
After that last posting, but before your response, I asked them to add the local farm to their trusted sites zone. Several blogs I had encountered while searching had listed that as something they had tried.
As soon as they added the site to their trusted site zone, the problems went away.
It was definitely not all users - I only had 2 people directly contact me about the issue.
I never got a chance to ask them about other SharePoint sites - they were working on the sites where they spent most of their time - I don't know if they had other sites.
The old location and the new location of these 2 sites are in the same site collection - it was moving them from
http://myfarm/sites/div/dept67/site1
to
http://myfarm/sites/div/dept64/site1
basically (with the actual names changed to protect my job).
The site collection is /sites/div . So the site collection features are the same.
I suppose that the site features could have changed between the export and the import - but since things are working now and I didn't change any features, I don't think that it is.
At this point, things appear to be working. However strange that seems to me. -
We are trying to create folder & subfolder in a SharePoint document library using SharePoint default(dws) web service. Document library has unique permission as well as item level permission. It was working as expected. Once item count crosses
view threshold limit ( 5000) , create folder web method completes with an error and it creates a folder in SharePoint.
Request:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:dws="http://schemas.microsoft.com/sharepoint/soap/dws/">
<soapenv:Header/>
<soapenv:Body>
<dws:CreateFolder>
<!--Optional:-->
<dws:url>Shared Documents/VenTest02092015v1</dws:url>
</dws:CreateFolder>
</soapenv:Body>
</soapenv:Envelope>
Response:
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<soap:Body>
<CreateFolderResponse xmlns="http://schemas.microsoft.com/sharepoint/soap/dws/">
<CreateFolderResult><Error ID="2">Failed</Error></CreateFolderResult>
</CreateFolderResponse>
</soap:Body>
</soap:Envelope>
While trying to create subfolder under the above created folder service throws an exception saying
FolderNotFound.
Though we are able to create subfolder from SharePoint UI successfully.
Request
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:dws="http://schemas.microsoft.com/sharepoint/soap/dws/">
<soapenv:Header/>
<soapenv:Body>
<dws:CreateFolder>
<!--Optional:-->
<dws:url>Shared Documents/VenTest02092015v1/REQ-1</dws:url>
</dws:CreateFolder>
</soapenv:Body>
</soapenv:Envelope>
Response:
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<soap:Body>
<CreateFolderResponse xmlns="http://schemas.microsoft.com/sharepoint/soap/dws/">
<CreateFolderResult><Error ID="10">FolderNotFound</Error></CreateFolderResult>
</CreateFolderResponse>
</soap:Body>
</soap:Envelope>Yes, you're probably hitting the 5000 list item threshold (
http://sharepoint.stackexchange.com/questions/105937/overcoming-5000-file-document-library-limits ). I assume you can do it via the UI because you're probably logged in as an admin in which case, out of memory, the threshold is 20.000 items. You can extend
this limit, but you probably shouldn't.
Kind regards,
Margriet Bruggeman
Lois & Clark IT Services
web site: http://www.loisandclark.eu
blog: http://www.sharepointdragons.com -
Rename a File in a SharePoint document library through Client object model
Hi,
How to Rename a File in a SharePoint document library through Client object model?
Thanks
Poomani SankaranHi,
According to your description, you want to rename file in the document library using SharePoint Client Object Model.
Here is a code snippet works well in my environment for your reference:
static void Main(string[] args)
string url = "http://sp2013sps/sites/test/";
ClientContext clientContext = new ClientContext(url);
Microsoft.SharePoint.Client.List spList = clientContext.Web.Lists.GetByTitle("Documents");
clientContext.Load(spList);
clientContext.ExecuteQuery();
if (spList != null && spList.ItemCount > 0)
Microsoft.SharePoint.Client.CamlQuery camlQuery = new CamlQuery();
camlQuery.ViewXml =@"<View> <Query> <Where><Eq><FieldRef Name='LinkFilenameNoMenu' /><Value Type='Computed'>New Microsoft Word Document.docx </Value></Eq></Where> </Query> <ViewFields><FieldRef Name='Title' /></ViewFields> </View>";
ListItemCollection listItems = spList.GetItems(camlQuery);
clientContext.Load(listItems);
clientContext.ExecuteQuery();
listItems[0]["Title"] = "word.docx";
listItems[0]["FileLeafRef"] = "word.docx";
listItems[0].Update();
clientContext.ExecuteQuery();
More information about SharePoint Client Object Model:
http://msdn.microsoft.com/en-us/library/office/ee537247(v=office.14).aspx
http://www.codeproject.com/Articles/399156/SharePoint-Client-Object-Model-Introduction
http://www.learningsharepoint.com/2010/07/12/programmatically-upload-document-using-client-object-model-sharepoint-2010/
Best regards -
How to rename the SharePoint Document Library existing file name using Web service
Hi,
How to rename the SharePoint Document Library existing file name using SharePoint Web service.
Is it possible. How could i do it?
Thanks & Regards
Poomani SankaranHi,
Lists.UpdateListItems Method
would be helpful for your requirement.
Here is a blog with code demo for your reference:
http://blogs.msdn.com/b/knowledgecast/archive/2009/05/20/moss-using-the-list-web-service-to-rename-a-file.aspx
Best regards,
Patrick
Patrick Liang
TechNet Community Support
Maybe you are looking for
-
[solved] nautilus and missing thumbnail
hi to everybody, i have a little problem: i can't have working thumbnail preview of video file pdfs and images works i try to fix the issue with this script: #!/bin/bash VIDEO_EXTENSIONS="video@flv video@webm video@mkv video@mp4 video@mpeg \ video@av
-
How to change the color of the data in a advanceddatagrid based on the its value
Hi All, I'm loading the data into AdvanceddataGrid from XML. My requirement is like; if the value of the loaded data is lower than 5, then it should be shown Green in color. Or else if it is greater than 5 it should be shown in Red color. I
-
Querying the output of a batch/scheduled report
We haven't move to Discoverer Viewer as of now. One of the questions I have to those who have already implemented it is, can you schedule a batch report in the viewer and then users are able to query the RESULT of it without querying back the databas
-
Delivery Type Not Defined.
Dear All, User has created a (subsequent del.free of charge) sls order. Fine. At the time of creating delivery, system shows the del screen but it doesnt fetch the data frm the order, when i see the log it cries "Del type zsdf is not defined" . Obvio
-
Using Collections and initialisation
I am not in the IT business but I am trying to teach myself Java using the JBuilder IDE. I am creating an application which will contain the personal details of each individual user along with a record of the training/work they undertake on different