Uploading XML file to SharePoint Online Document Library
Hi,
I got a scenario to upload the xml file the sharepoint library along with that the XML has some information like UserName, Email. Phone and these information has to be captured to the metadata information of that file in the sharepoint library.
Let me know if you have a solution for this.
Thanks
Karthik
Hi Karthik,
Per my understanding, there is an XML file contains attributes. You want to upload it to a SharePoint library as well as extract the values of those attributes to
save to the corresponding columns of the SharePoint library.
As it is an Online environment, a workaround I would suggest is that you can create a client application(such as Windows Form Application) to extract values from the
XML file, then upload the file to SharePoint library, submit the values to the same library afterwards. All this can be achieved using SharePoint Client Object Model.
How to: Complete basic operations using SharePoint 2013 client library code
http://msdn.microsoft.com/en-us/library/office/fp179912(v=office.15).aspx
About how to upload file to SharePoint library using Client Object Model:
http://blogs.msdn.com/b/sridhara/archive/2010/03/12/uploading-files-using-client-object-model-in-sharepoint-2010.aspx
About how to read XML from a file by using Visual C#:
https://support.microsoft.com/en-us/kb/307548?wa=wsignin1.0
Thanks
Patrick Liang
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]
Similar Messages
-
Javascript to upload a file to SharePoint 2010 document library
Please share your ideas. I am using SharePoint 2010. Currently when uploading files to a document library, first the upload form is opening to upload the document and then the edit form. I would like to have both this in the same form. I am trying to
create a webpart page with the controls to upload the file to document library and assign values to the fields in the library. I am looking for some javascript for doing this. Is there any other way of achieving this? Please share any sample
code.
<label for="title">Enter the title for this document:</label> <input type="text" id="title"><br/><br/>
<input id="inputFile" type="file"/><br/><br/>
<input id="uploadDocumentButton" onclick="UploadDocument()" type="button" value="Upload Document"/><script type="text/javascript">
function UploadDocument() {
//javascript to upload the file to MyLibrary and update the title field
</script>Use the below code step by step :)
(1) Html
<input type="file" id="attafh" class="AlltextAccount" />
<input type="button" value="upload" onclick="rundCode()" />
(2) JS File
function rundCode() {
var file = document.getElementById('attafh').files[0];
if (file) {
UploadMe(file);
(3)
function UploadMe(readFile) {
var reader = new FileReader();
reader.readAsArrayBuffer(readFile); //array buffer
reader.onprogress = updateProgress;
reader.onload = loaded;
reader.onerror = errorHandler;
(4)
function loaded(evt) {
var fileString = evt.target.result;
var X = _arrayBufferToBase64(fileString); // this is the mothod to convert Buffer array to Binary
var fileInput = document.getElementById('attafh');
var fileDisplayArea = document.getElementById('fileDisplayArea');
var file = fileInput.values;
var filePath = $('#attafh').val(); // "c:\\test.pdf";
var file = filePath.match(/\\([^\\]+)$/)[1];
var soapEnv =
"<soap:Envelope xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xmlns:xsd='http://www.w3.org/2001/XMLSchema' xmlns:soap='http://schemas.xmlsoap.org/soap/envelope/'> \
<soap:Body>\
<CopyIntoItems xmlns='http://schemas.microsoft.com/sharepoint/soap/'>\
<SourceUrl>" + filePath + "</SourceUrl>\
<DestinationUrls>\
<string>http://intranet/sites/English/DocumentLibrary/" + file + "</string>\
</DestinationUrls>\
<Fields>\
<FieldInformation Type='Text' DisplayName='Title' InternalName='Title' Value='Test' />\
<FieldInformation Type='Text' DisplayName='BudgetId' InternalName='BudgetId' Value='8' />\
</Fields>\
<Stream>" + X + "</Stream>\
</CopyIntoItems>\
</soap:Body>\
</soap:Envelope>";
$.ajax({
url: "http://intranet/_vti_bin/copy.asmx",
beforeSend: function (xhr) { xhr.setRequestHeader("SOAPAction", "http://schemas.microsoft.com/sharepoint/soap/CopyIntoItems"); },
type: "POST",
dataType: "xml",
data: soapEnv,
complete: processResult,
contentType: "text/xml; charset=\"utf-8\""
SP.SOD.executeOrDelayUntilScriptLoaded(initialize, 'SP.js');
SP.SOD.executeOrDelayUntilScriptLoaded(test, 'SP.js');
function errorHandler(evt) {
if (evt.target.error.name == "NotReadableError") {
// The file could not be read.
function _arrayBufferToBase64(buffer) {
var binary = ''
var bytes = new Uint8Array(buffer)
var len = bytes.byteLength;
for (var i = 0; i < len; i++) {
binary += String.fromCharCode(bytes[i])
return window.btoa(binary);
(5)
function updateProgress(evt) {
http://www.abdulazizfarooqi.wordpress.com Abdul Aziz Farooqi [BizTalk & SharePoint Consultant] MCPD Web & MCPD SharePoint 2010 -
Upload/Download file to/from a document library in a SharePoint online site
Hi,
I am referring to the below blog for Upload/Download file to/from a document library in a SharePoint online site.
http://blogs.msdn.com/b/rohitpuri/archive/2007/04/10/upload-download-file-to-from-wss-document-library-using-dav.aspx?CommentPosted=true#commentmessage
I would like to know if this is feasible with a SharePoint online site.
If feasible, how can I resolve the below exception I am getting while using the code.
“The remote server returned an error: (403) Forbidden”.
Thanks,
ThananHi,
Actually what I am trying to achieve is the two things.
1) By using only the user's name, need to upload/download from/to the document library of SharePoint online site using the CSOM. (i.e., achieving Single Sign On / Windows Authentication)
2) I need to achieve the above only by passing the document URL; not by hardcording/ configuring the document library name in the windows application.
Can anyone pls help on this now?
[Below code is working fine. But need to arrive the solution whereas the above 2 conditions are not violated.
using (var clientContext
= new ClientContext("https://yoursiteurl.com"))
string passWd
= "password";
SecureString securePassWd
= new SecureString();
foreach
(var c in passWd.ToCharArray())
securePassWd.AppendChar(c);
clientContext.Credentials
= new SharePointOnlineCredentials("username", securePassWd);
using
(var fs =
new FileStream("fileName",
FileMode.Open))
var fi =
new FileInfo("fileName");
var list = clientContext.Web.Lists.GetByTitle("Doc Library");
clientContext.Load(list.RootFolder);
clientContext.ExecuteQuery();
var fileUrl = String.Format("{0}/{1}", list.RootFolder.ServerRelativeUrl,
fi.Name);
Microsoft.SharePoint.Client.File.SaveBinaryDirect(clientContext, fileUrl,
fs, true);
Thanks,
Thanann -
Connect to SharePoint Online Document Library from Excel
We have a number of people in the field who fill out fairly complex evaluation forms in excel. These forms are submitted to a document library in SharePoint Online
What I need to be able to do is report off these submitted excel files reading and consolidating specific data (they are all of a consistent format). There may be any number of excel sheets in the source document library
Previously I would have done this using VBA but I cannot find a way of connecting to a sharepoint online document library from excel vba - I am open to other optionsHi Karthik,
Per my understanding, there is an XML file contains attributes. You want to upload it to a SharePoint library as well as extract the values of those attributes to
save to the corresponding columns of the SharePoint library.
As it is an Online environment, a workaround I would suggest is that you can create a client application(such as Windows Form Application) to extract values from the
XML file, then upload the file to SharePoint library, submit the values to the same library afterwards. All this can be achieved using SharePoint Client Object Model.
How to: Complete basic operations using SharePoint 2013 client library code
http://msdn.microsoft.com/en-us/library/office/fp179912(v=office.15).aspx
About how to upload file to SharePoint library using Client Object Model:
http://blogs.msdn.com/b/sridhara/archive/2010/03/12/uploading-files-using-client-object-model-in-sharepoint-2010.aspx
About how to read XML from a file by using Visual C#:
https://support.microsoft.com/en-us/kb/307548?wa=wsignin1.0
Thanks
Patrick Liang
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] -
Can't open MS Word .doc files from SharePoint 2013 document library?
Hello,
I have uploaded some MS Word files with .doc extension into a SharePoint 2013 document library, but they don't open when clicked. I can do a number of things to the file, like view and edit properties, download and other things, but it does not
open up when mouse clicked. There are PDF files in the document library and they open up just fine. Any ideas?
I should add that MS Word 2010 .docx files can not be opened either.
Thanks.
PaulHi,
Whether you use office 2013.
Considering this .doc file can be smoothly opened in Office if you downloaded it to your local, it indicates that the Word document and Microsoft Word doesn’t have any problems. The issue may be caused by the compatibility between Office
and your site.
1.Check whether you have the SharePoint OpenDocuments Class add on enabled at first.
Internet Explorer >Tools iron > Manage add-ons >
Choose to Show All add-ons. Find SharePoint OpenDocuments Class and make sure it’s enabled.
2.go to Compatibility view settings > add your SharePoint site to compatibility view
3.go to Internet Options,
Advanced > Reset… > Check Delete personal settings and reset
Security > Trusted sites > sites > add SharePoint sites to trusted sites
4.If it doesn’t work, please open Word, go to Options > Trust Center > Trust Center Settings > Protected View > Uncheck all.
Best Regards,
Lisa Chen
Lisa Chen
TechNet Community Support -
Cannot able to save Excel 2013 file in Sharepoint 2007 document library
Dear All,
We have SharePoint 2007 intranet portal where in we have teamplace created for internal users to collaborate on documents.
Now we are having issues when using uploads Excel 2013 or Excel 2010 file on document library and try to edit the document.
Sometimes it doesn't allow to check out the file it say someone already checked out ..but when I try in my laptop its OK.
And some times when user opens the file it opens as non editable file and it does not take any changes.
Pls advise whether there is issue with SharePoint 2007 document library and Office Excel 2010,2013 files.
-- Regards SandeepThe lock can apply in two places. Are you seeing the message in your browser or does it arise within Excel itself?
Steven Andrews
SharePoint Business Analyst: LiveNation Entertainment
Blog: baron72.wordpress.com
Twitter: Follow @backpackerd00d
My Wiki Articles:
CodePlex Corner Series
Please remember to mark your question as "answered" if this solves (or helps) your problem. -
I've got a document library on my SharePoint Online site. I've enabled the Title column in the library view. When I upload Word documents, the title I entered into the document properties list (Word 2010, File > Info > Properties list > Title) appears
in the Title column of my library in SharePoint. But when I upload the published PDF version (created from the same Word file using Word 2010 by File > Save As) to the library, there's nothing in the Title column. Why? Is SharePoint failing to read the
metadata of the PDF file? Is Word 2010 failing to copy the metadata into the PDF file when it's created from the Word file?
What's going wrong and how do I fix it?
When answering, please keep in mind that I'm a SharePoint novice.
Regards,
Bruce OfficerI think I've ruled out the possibility that Word isn't saving the Title property with the PDF when I convert to PDF using Word 2010's built-in Save As PDF command. I found a utility called Evermap AutoMetadata which shows all the metadata saved in a PDF
file and the Title field is indeed present in the PDF, with the correct value. Windows File Explorer won't show that property as present, but AutoMetadata does. It now looks like SharePoint isn't reading that field for some reason. Does anyone know why, and
what I should do about it? -
Upload file to nested file in SharePoint 2013 document library
Hi,
I want to retrieve foders & subfolder from document library and bind it with a dropdownlist.I am able to bind all folder & subfolderto the dropdownlist as below image.
Now I want upload a file to folder selected in the drop down list.By using the below code I am able to add files in the root folder,but while submitting the file to sub folder it showing "Value does not fall in this range"
if (item.Title == ddlFolderName.SelectedValue)
if (item != null)
SPFolder selfold = lifolder.RootFolder.SubFolders[ddlFolderName.SelectedValue];
SPFile fFile = selfold.Files.Add(System.IO.Path.GetFileName(FileUpload1.PostedFile.FileName),
byt);
fFile.Item.Update();
fFile.Update();
lblMsg.Text = "File added";
}}Please help.Thank youHi Aditi,
For uploading a file into a nested folder you could consider the following approach:
ensure the target folder exist using the method provided below
upload a file using
SPFileCollection.Add method
How to ensure a nested Folder exist using SharePoint SSOM
internal static class SPFolderExtensions
/// <summary>
/// Ensure SPFolder
/// </summary>
/// <param name="web"></param>
/// <param name="listTitle"></param>
/// <param name="folderUrl"></param>
/// <returns></returns>
public static SPFolder EnsureFolder(this SPWeb web, string listTitle, string folderUrl)
if (string.IsNullOrEmpty(folderUrl))
throw new ArgumentNullException("folderUrl");
var list = web.Lists.TryGetList(listTitle);
return CreateFolderInternal(list, list.RootFolder, folderUrl);
private static SPFolder CreateFolderInternal(SPList list, SPFolder parentFolder, string folderUrl)
var folderNames = folderUrl.Split(new char[] {'/'}, StringSplitOptions.RemoveEmptyEntries);
var folderName = folderNames[0];
var curFolder =
parentFolder.SubFolders.Cast<SPFolder>().FirstOrDefault( f => System.String.Compare(f.Name, folderName, System.StringComparison.OrdinalIgnoreCase) == 0);
if (curFolder == null)
var folderItem = list.Items.Add(parentFolder.ServerRelativeUrl, SPFileSystemObjectType.Folder,
folderName);
folderItem.SystemUpdate();
curFolder = folderItem.Folder;
if (folderNames.Length > 1)
var subFolderUrl = string.Join("/", folderNames, 1, folderNames.Length - 1);
return CreateFolderInternal(list, curFolder, subFolderUrl);
return curFolder;
How to create nested Folder using SharePoint SSOM
internal static class SPFolderExtensions
/// <summary>
/// Ensure SPFolder
/// </summary>
/// <param name="web"></param>
/// <param name="listTitle"></param>
/// <param name="folderUrl"></param>
/// <returns></returns>
public static SPFolder CreateFolder(this SPWeb web, string listTitle, string folderUrl)
if (string.IsNullOrEmpty(folderUrl))
throw new ArgumentNullException("folderUrl");
var list = web.Lists.TryGetList(listTitle);
return CreateFolderInternal(list, list.RootFolder, folderUrl);
private static SPFolder CreateFolderInternal(SPList list, SPFolder parentFolder, string folderUrl)
var folderNames = folderUrl.Split(new char[] {'/'}, StringSplitOptions.RemoveEmptyEntries);
var folderName = folderNames[0];
var curFolder =
parentFolder.SubFolders.Cast<SPFolder>()
.FirstOrDefault(
f =>
System.String.Compare(f.Name, folderName, System.StringComparison.OrdinalIgnoreCase) ==
0);
if (curFolder == null)
var folderItem = list.Items.Add(parentFolder.ServerRelativeUrl, SPFileSystemObjectType.Folder,
folderName);
folderItem.SystemUpdate();
curFolder = folderItem.Folder;
if (folderNames.Length > 1)
var subFolderUrl = string.Join("/", folderNames, 1, folderNames.Length - 1);
return CreateFolderInternal(list, curFolder, subFolderUrl);
return curFolder;
Key points:
Ability to create a nested folder(s)
Existing folders will not be affected
The following example demonstrates how to ensure the following folder structure exist under
Documents library and upload a file into it:
Orders
|
A --
|
A1
Example:
var folder = web.CreateFolder("Documents", "Orders3/Orders A/Orders A1");
Example: how to upload a file into a nested folder
var targetFolder = web.EnsureFolder("Documents", "Orders3/A/A1");
var fileContent = System.IO.File.ReadAllBytes(fileName);
var fileUrl = Path.GetFileName(fileName);
targetFolder.Files.Add(fileUrl, fileContent);
Thanks & Regards
Indul Hassan
www.indulhassan.com -
SharePoint Online Document Library different upload process ?
I'm pretty new to office 365.... Why is the document library different in terms of uploading ? What I mean is.. When I upload a document it doesn't give me the option to edit the properties first before it uploads the document.. ON the on-prem version
when you upload you have the chance to define the item properties. Kindly please help ?
AJ MCTS: SP 2010 Configuration MCSA: Windows 7 If you find this post useful kindly please mark it as an answer :) TYI am not 100% sure if this will answer you question as I also noticed on SharePoint Online that when none of your metadata are required metadata it upload the document to library rather than giving you an option to define values for those metadata as opposed
ton on-prem will give you an option to define values regardless of metadata is required or not.
One workaround you can use is to go to document library advanced settings and select YES to allow management of content type. Do not add or modify anything but turning that option to Yes will force document library to show you the metadata page after you
upload the document.
Amit -
Workflow to change file permission in SharePoint Online Document Library
1.What are my options with SPD 2013 If I want to change a documents file permission in a workflow?
2.Where does SPO host 2013 Workfows?
3.If connecting to SPO Can I use Worklow Manager 1.0?
4.Will I need to host my Workflow Manager workflows on server or Azure if running against o365/SPO?
5.If I wish to create SPO 2013 workflows with Visual Studio 2012, what do I need and will I be limited to actions I see in SPD 2013?
============================
Thank You
cyberpine.comYou can host this workflow as a SharePoint App in SharePoint Online or use SharePoint Designer to create this workflow as long as you use the app step. Managing the permissions can be done with a REST call. The initiator of the workflow must have
been granted the right to "Manage Permissions" and the app must have full control of the Site Collection. We have done so for several of our clients. I know you asked this question some time ago, but I thought the info might still be helpful. -
Hiding the MS Word Web App toolbar in SharePoint Online Document Library
Hi Guys!
Badly needed your input on this scenario. I've created a document library in SharePoint Online but when I add a document I wanted the MS Word Web App toolbar to be hidden as I didn't want to have the document printed and downloaded. Just
want to have the file in read only mode.
I've come across subscription to IRM of Office 365 as a solution but it's kinda expensive for this need.
Any idea on how to resolve this scenario would be greatly appreciated.
Thanks,
VenusHi!
Even if I give a view-only permission to the user, still the print button is available and the document can still be downloaded to PDF file.
Also, the permission rights given to the users of the document library is contributor. But after routing for approval and the content is approved. It should be read-only even to the one who authored the document.
I've checked also IRM for a solution but unfortunately what we have is E1 package so IRM is out of the option.
Thanks,
Venus -
How to hide the MS Word Web App in SharePoint Online Document Library
Hi Guys!
Badly needed your input on this scenario. I've created a document library in
SharePoint Online but when I add a document I wanted the MS Word Web App toolbar
to be hidden as I didn't want to have the document printed and downloaded. Just want to have the file in read only mode.
I've come across subscription to IRM of Office 365 as a solution but it's kinda expensive for this need.
Any idea on how to resolve this scenario would be greatly appreciated.
Thanks,
VenusHi!
Even if I give a view-only permission to the user, still the print button is available and the document can still be downloaded to PDF file.
Also, the permission rights given to the users of the document library is contributor. But after routing for approval and the content is approved. It should be read-only even to the one who authored the document.
I've checked also IRM for a solution but unfortunately what we have is E1 package so IRM is out of the option.
Thanks,
Venus -
Question about renaming sync'd SharePoint Online document library with OneDrive Pro
If I have a site called http://mycompany.sharepoint.com/sites/Department/Documents created as a document library subsite, the OneDrive Pro share will show it under "OneDrive @ My Company" as "Documents - Documents".
What would I need to change in order for the OneDrive sync'd view to show as "SubsiteName Documents - Documents"?
Can I do this by just changing the title of the subsite's header (i.e. changing 'Documents' to 'Department Documents', or does the whole subsite path name need to be changed (i.e. /sites/Department/DepartmentDocuments/)?You can invite people to your SharePoint site using External Accounts (Microsoft Accounts or other tenant Office 365 accounts) which there is no charge for.
Office 2010 will not currently impact your ability to use O356.
http://office.microsoft.com/en-us/office365-sharepoint-online-enterprise-help/manage-external-sharing-for-your-sharepoint-online-environment-HA102849864.aspx
Trevor Seward
Follow or contact me at...
  
This post is my own opinion and does not necessarily reflect the opinion or view of Microsoft, its employees, or other MVPs. -
Download RSS feed as xml file from Sharepoint Online using PowerShell
Hello
Our company sharepoint (Office 365) contains also several RSS feeds.
How it is possible to download xml file out of this feed (website) using PowerShell?
I can authenticate with sharepoint using CSOM but do not what to do next.
As service user is not administrator I cannot use "SPOService".
This script works OK for standard website, but not for Sharepoint.
$doc = New-Object System.Xml.XmlDocument
$doc.Load("http://www.{CompanySite}.com/feed/")
$doc.save("C:\temp\feed.xml")
I am getting this error when using for company Sharepoint:
"The remote server returned an error: (403) Forbidden."
Thanks for your time considering this question.
JozinHi Scott,
thanks for advice.
Combination of WebClient and Sharepoint Credentials is working OK:
$client = New-Object System.Net.WebClient
$client.Credentials = New-Object Microsoft.SharePoint.Client.SharePointOnlineCredentials($User, $SecurePassword)
$client.Headers.Add("X-FORMS_BASED_AUTH_ACCEPTED", "f")
$client.DownloadFile($SiteURL, $file) -
Upload large file in sharepoint
hi
is it possible upload large file in sharepoint in our scenario we need upload large file >3gb in document libraries
where sharepoint store files? is there any way we can have a custom aspx page for uploading large files in chunks in document library?
kindly suggest.
Thankyouis not possbile upload more than 2Gb
If you try to upload big files you will need to make some change on your Sharepoint to support the 2Gb.
Error message when you try to upload a large file to a document library on a Windows SharePoint Services 3.0 site: "Request timed out"
http://support.microsoft.com/?id=925083
With files bigger than 2GB can recomend creeate linked files to that files where you can download.
André Lage Microsoft SharePoint and CRM Consultant
Blog:http://aaclage.blogspot.com
Codeplex:http://spupload.codeplex.com/http://simplecamlsearch.codeplex.com/
Maybe you are looking for
-
Trying to get an external hard drive that is connected to my Airport Extreme to also be connected to my iMac via firewire 800. Any ideas?
-
What are the settings for connecting to a Mac behind a wireless router?
I have a client with an iMac. His Mac connects to the internet through a wireless router which gets its signal from a cable modem. My Mac is running 10.6. The remote iMac is running 10.5. How do I configure my Mac (Administrator) and the remote iMac
-
I just bought an iPod shuffle 1gb and i'm having the following problem. I have a huge mp3 collection divided into different cds. The thing is that everytime i send mp3s from a CD to the iPod and reconnect the pod (withouth having the CD in the CD-ROM
-
Cross company subcontrating in sap with same company code
Dear Sir we have an scinario of cross company subcontrating in sap with same company code , take an example my plat is 1003 and another is 1019 with same company code, so is it possible to do subcontracting ? i will process doccoumntation like j1if01
-
Can't open email in Inbox only, can read all other mailboxes?
I am new to Mac products and may have deleted something I wasn't supposed to. My inbox indicates that I have 6 messages but I can't see them to open them. All other mailboxes are fine.