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.

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);
    Darwaish

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

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

    Hi 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

  • 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

  • How to read excel file in document library and store excel content in sql table

    Hello,
    Can anyone help me how to read the excel file present in document library and store the content inside excel into sql table?
    Please let me know the ways to acheive this. Feel free to give your suggestions.
    Thanks,
    Cool Developer

    Hi!
    this code i have written becuase i donot find any soltions on net for this , u can try with this . :)
    System.Data.OleDb.
    OleDbConnection ExcelConnection = null;
    FileMode fileMode;
    string filePath = ConfigurationManager.AppSettings["TempLoaction"] + "\\" + fileName;
    using (SPSite _site = new SPSite(SPContext.Current.Web.Url))
    using (SPWeb _web = _site.OpenWeb())
    string docLibrary = ConfigurationManager.AppSettings["DocumentLibrary"];
    SPFile _file = _web.GetFile("/" + docLibrary + "/" + fileName);
    fileMode =
    FileMode.Create;
    byte[] byteArray = _file.OpenBinary();
    MemoryStream dataStream = new MemoryStream(byteArray);
    Stream stream = dataStream;
    using (FileStream fs = File.Open(filePath, fileMode))
    byte[] buffer = new byte[4096];
    int bytesRead;
    while ((bytesRead = stream.Read(buffer, 0, buffer.Length)) != 0)
    fs.Write(buffer, 0, bytesRead);
    fs.Close();
    //Create the Connection String
    try
    string ConnectionString = @"Provider=Microsoft.Jet.OLEDB.4.0;
    Data Source ='"
    + filePath + "'; Extended Properties=Excel 5.0";
    //Create the connection
    ExcelConnection =
    new System.Data.OleDb.OleDbConnection(ConnectionString);
    //create a string for the query
    string ExcelQuery;
    //Sheet1 is the sheet name
    //create the query:
    //read columns from the Excel file
    ExcelQuery =
    "Select * from [Sheet1$]"; // from Sheet1";
    //use "Select * ... " to select the entire sheet
    //create the command
    System.Data.OleDb.
    OleDbCommand ExcelCommand = new System.Data.OleDb.OleDbCommand(ExcelQuery, ExcelConnection);
    //Open the connection
    ExcelConnection.Open();
    //Create a reader
    System.Data.OleDb.
    OleDbDataReader ExcelReader;
    ExcelReader = ExcelCommand.ExecuteReader();
    //For each row after the first
    while (ExcelReader.Read())
    thanks,
    kshitij

  • How to Auto Check-in .pdf Files in a Document library(after Drag & Drop) - sharepoint 2013?

    Hi,
    Once I Drag and drop the .pdf documents in a document library files get
    checked out automatically.
    I want the files to be checked-in automatically once they are dragged and Dropped.
    Please note : I am able to do the above things with .doc (world files) but not with the
    .pdf files.
    I have provided all the default values. Tried all the below options Still no success :-( 
    Require Content Approval for submitted items ?    NO
    Create a version each time you edit a file in this document library ? No visioning
    Require documents to be check out before they can be edited? No
    Anyone Come across this issue.??
    Regards, 
    Pavan.

    Hi, 
    I found the problem(Not the solution).
    I have set the default values from Column default value settings,
    the default values are getting set to the columns but the file still in checked-out mode.
    If I put the defult values to Library columns directly/Site column directly , Its working fine. - We found this work-around. 
    But still the issue Exists why its not working when I set Default values from Column default value settings
    and try to drag and drop documents. :-( 

  • 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 ?
    Thanks

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

  • Cannot edit properties after overwriting file in a document library

    I am (programmatically) overwriting a file in a document library after which none of the metadata fields can be edited either programmatically or manually:
    Edit Properties -> change something -> Save
    There is no error, just none of the metadata fields will actually update. To overwrite the file, I am using copy.asmx webservice. I get the same result when overwriting via REST, or just doing a plain http PUT. I also tried list.asmx webservice to update metadata.
    As long as I don't overwrite a file, everything works great.
    This is Sharepoint 2010. Versioning is off, checkout is not required. "Overwriting" means there is an existing file, previously uploaded manually or with copyservice and the new file has the same name.
    Has anybody seen this behavior? (or managed to get a sharepoint document library file into a similar state).
    Thanks, RL

    Hi,
    According to your post, my understanding is that after uploading file using the Copy.asmx web service, you could not edit the properties.
    I had used the following code to upload the file, after that to edit the properties, it worked without any issue.
    static void Main(string[] args)
    Copy copy = new Copy();
    copy.Credentials = new System.Net.NetworkCredential("UserName","Password","Domain");
    copy.Url = "http://sp/_vti_bin/copy.asmx";
    string filePath = @"C:\Test\Edite2.txt";
    string[] destURL = { @"http://sp/LIbA/Edite2.txt" };
    FileStream fs = new FileStream(filePath, FileMode.Open, FileAccess.Read);
    byte[] contents = new byte [fs.Length];
    fs.Read(contents,0,Convert.ToInt32(fs.Length));
    fs.Close();
    FieldInformation fileFieldInfo = new FieldInformation();
    fileFieldInfo.DisplayName = "Edite2";
    fileFieldInfo.Value = "Edite2";
    fileFieldInfo.InternalName = "Edite2";
    fileFieldInfo.Type = sp.FieldType.Text;
    FieldInformation[] fileFieldInfoArray = { fileFieldInfo };
    CopyResult copyResult1 = new CopyResult();
    CopyResult copyResult2 = new CopyResult();
    CopyResult[] copyResultArray = { copyResult1,copyResult2};
    uint resultCopy = copy.CopyIntoItems(filePath,destURL,fileFieldInfoArray,contents,out copyResultArray);
    Console.WriteLine("Upload Successful...");
    Console.ReadKey();
    You can check with the above code, then check whether it works.
    Did the issue occur in other libraries?
    You can create new library to check whether it works, maybe the library had been corrupted.
    Thanks & Regards,
    Jason
    Jason Guo
    TechNet Community Support

  • Not able to copying files/folders from one Document Library to another Document Library using Open with Browser functionality

    Hi All, 
    We have SharePoint Production server 2013 where users are complaining that they are not able to copy or move files from one document library to another document library using “Open with Explorer” functionality.
    We tried to activate publishing features on production server but it did not work. We users reported following errors:  
    Copying files from one document library to another document library:
    Tried to map the document libraries and still not get the error to copy files: 
    In our UAT environment we are able to copy and move folders from using “Open with Explorer” though.
    We have tried to simulate in the UAT environment but could not reproduce the production environment.  
    Any pointers about this issue would be highly appertained.
    Thanks in advance
    Regards,
    Aroh  
    Aroh Shukla

    Hi John and all,
    One the newly created web applications that we created few days back and navigated to document library, clicked on “Open with Explorer”, we get this error.
    We're having a problem opening this location in file explorer. Add this website to your trusted and try again.
    We added to the trusted site in Internet Explorer for this web application, cleared the cache and open the site with same document library but still get the same above error.
    However, another existing web application (In same the Farm) that we are troubleshooting at the moment, we are able click on “Open with Explorer”,  login in credentials opens and we entered the details we are able to open the document
    library and tried to follow these steps:
    From Windows Explorer (using with Open with Explorer), tried to copy or move a files to
    source document library.
    From Windows Explorer moved this file to another destination document library and we got this error.
    What we have to achieve is users should be able to copy files and folders using
    Open with Explorer functionality. We don’t know why Open with Explorer
    functionality not work working for our environment.  
    Are we doing something wrong? 
    We have referred to following websites.
    we hope concepts of copying / Moving files are similar as SharePoint 2010. Our production environment is SharePoint 2013.   
    http://www.mcstech.net/blog/index.cfm/2012/1/4/SharePoint-2010-Moving-Documents-Between-Libraries https://andreakalli.wordpress.com/2014/01/28/moving-or-copying-files-and-folders-in-sharepoint/
    Please advise us. Thank you.
    Regards,
    Aroh
    Aroh Shukla

  • How to update managed metadata column for all file in document library using powershell

    Hi,
    How to update managed metadata column for all file in document library using powershell?
    Any help on it.
    Thanks & REgards
    Poomani Sankaran

    Hi TanPart,
    I have changed the code which you have give in order to get the files from SharePoint 2010 Foundation  Document Library.But i am getting below error in powershell.
    Property 'ListItemCollectionPosition' cannot be found on this object; make sure it exists and is settable.
    Could you tell me which is the issues in it?
    See the code below.
    $web = Get-SPWeb http://ntmoss2010:9090/Site
    $list = $web.Lists["DocLib"]
    $query = New-Object Microsoft.SharePoint.SPQuery
    $query.ViewAttributes = "Scope='Recursive'";
    $query.RowLimit = 2000
    $caml = '<Where><Contains><FieldRef Name="Title" /><Value Type="Text">Process Documents/Delivery</Value></Contains></Where>' +
            '<OrderBy Override="TRUE"><FieldRef Name="ID"/></OrderBy>'
    $query.Query = $caml
    do
        $listItems = $list.GetItems($query)
        $spQuery.ListItemCollectionPosition = $listItems.ListItemCollectionPosition
        foreach($item in $listItems)
            #Cast to SPListItem to avoid ambiguous overload error
            $spItem = [Microsoft.SharePoint.SPListItem]$item;
            Write-Host $spItem.Title       
    while ($spQuery.ListItemCollectionPosition -ne $null)
    Thanks & Regards
    Poomani Sankaran

  • Detect what the default edit form is for a document library and list using jquery

    Hi,
    So what I have done is with some jquery made it that when a files are dragged and dropped into a document library and there is a required field such as "Metadata" the EditForm.aspx opens up for the user to fill in the required column. I am building
    the url up from what I have found in SharePoints DragDrop.js file. This is all working perfectly I just need to find a way to dynamically find what the default edit form is for that document library as I have just hardcoded like this...
    g_currentControl.strSiteUrl + "/" + this.ListName + "/Forms/EditForm.aspx?ID=" + id
    So I need a way to figure out what the default edit form is instead of hard coding like this in case someone creates a custom_editform.aspx or something for one of the lists.
    Thanks

    You can get it by hitting this REST end point via JQuery:
    http://weburl/_api/Web/Lists(guid'YOURLISTGUID')/Forms
    Chris Givens CEO, Architecting Connected Systems
    Blog Twitter

  • Schedule the Publishing date of a file in Document Library using CSOM

    I am having a hard time to schedule the publishing date of a document uploaded to a sharepoint document library. Basicaly, what I want is to upload a file to a document library and to schedule it´s publishing for a future date, using CSOM. Then someone should
    approve this (file content and scheduled date and time for publishing).
    I am able to upload the document to the document library and to start the approval workflow automatically (when the document is uploaded), but I don´t know how to set the publishing date using client side object model.
    Apparently all I need to do is to set up the properties ScheduledItem.StartDate and ScheduledItem.EndDate, but I just can´t manage to do it. Any help will be very much appreciated.

    I am having a hard time to schedule the publishing date of a document uploaded to a sharepoint document library. Basicaly, what I want is to upload a file to a document library and to schedule it´s publishing for a future date, using CSOM. Then someone should
    approve this (file content and scheduled date and time for publishing).
    Scheduling is enable and the coluns StartDate and EndDate are already added to the document library. I am able to upload the document to the document library and to start the approval workflow automatically (when the document is uploaded), but I don´t know
    how to set the publishing date using client side object model.
    Apparently all I need to do is to set up the properties ScheduledItem.StartDate and ScheduledItem.EndDate, but I just can´t manage to do it. Any help will be very much appreciated.

  • Exception calling "Update" with "0" argument(s): "To add an item to a document library, use SPFileCollection.Add()"

    Hi i am trying to add a new item and update existing field value in a document library with powershell 
    but i receive below error message.
    PS C:\Users\spfarm> C:\Scripts\add.ps1
    Exception calling "Update" with "0" argument(s): "To add an item to a document
    library, use SPFileCollection.Add()"
    At C:\Scripts\add.ps1:24 char:16
    + $newItem.Update <<<< ()
        + CategoryInfo          : NotSpecified: (:) [], MethodInvocationException
        + FullyQualifiedErrorId : DotNetMethodException
    #Add SharePoint PowerShell Snapin which adds SharePoint specific cmdlets
    Add-PSSnapin Microsoft.SharePoint.PowerShell -EA SilentlyContinue
    #Variables that we are going to use for list editing
    $webURL = "http://tspmcwfe:89"
    $listName = "test"
    #Get the SPWeb object and save it to a variable
    $web = Get-SPWeb $webURL
    #Get the SPList object to retrieve the "Demo List"
    $list = $web.Lists[$listName]
    #Create a new item
    $newItem = $list.Items.Add()
    #Add properties to this list item
    $newItem["Title"] = "My second item!"
    $newItem["Info"] = "s15"
    #Update the object so it gets saved to the list
    $newItem.Update()
    $web.Dispose()
    adil

    Hi Adil,
    Document Library is different from a normal list. The document library contains files inside it. You need to update the code to add a document to the library. Then you can get hold of the List Item represented by that file and update its properties. Here
    is an example:
    $WebURL = "http://aissp2013/sites/TestSite"
    $DocLibName = "Docs" 
    $FilePath = "c:\blogs.txt" 
    # Get a variable that points to the folder 
    $Web = Get-SPWeb $WebURL 
    $List = $Web.GetFolder($DocLibName) 
    $Files = $List.Files
    # Get just the name of the file from the whole path 
    $FileName = $FilePath.Substring($FilePath.LastIndexOf("\")+1)
    # Load the file into a variable 
    $File= Get-ChildItem $FilePath
    # Upload it to SharePoint 
    $spFile = $Files.Add($DocLibName +"/" + $FileName,$File.OpenRead(),$false) 
    $item = $spFile.Item
    $item["Title"] = "New Title"
    $item.Update()
    $web.Dispose()
    Blog | SharePoint Learnings CodePlex Tools |
    Export Version History To Excel |
    Autocomplete Lookup Field

  • Authentication prompt issue when opening an office file in a document library with read permission for domain users

    An user as part of the domain users tries to open an office file from a document library but he got an authentication prompt asking him to authenticate. Domain users has only access to this library and not to the whole site. This uses to work in SharePoint
    2007 without any problem but not in SharePoint 2013, we didn't have a workflow on SP2007.
    Domain users has read access to only this document library in the site, but he shouldn't get an authentication prompt since he is part of the domain users and he is not trying to modify the document, he can open the document but gets two prompts, he can't
    also see the list using explorer view since nothings appears using the explorer view.
    Now, when opening the file, we can see..Updating Workflow Status, but we don't have any workflow working on this site or library, event any feature related to workflow.
    If we go to the event viewer in the server, we find this information,
    I also checked this thread but I couldn't find this scenario.
    https://social.technet.microsoft.com/Forums/sharepoint/en-US/91bc770b-bb70-4885-a4ad-a243edb88753/event-id-8026-workflow-soap-getworkflowdataforitem-failed-doc-library-no-workflow?forum=sharepointgeneralprevious
    I also created another list with the same permissions and using other office files but got the same behavior.
    Now, we have migrated this site from SP2007 to SP2013.
    Any ideas?

    OK, I am going to throw out a lot of ideas here so hopefully they get you closer to a diagnosis. Hang on :)
    Does it happen to work for some users but not others? If so, try logging in on the "good" computer with the "bad" username. This will tell you if the problem is related to the end-user's system. Also, once the user downloads a document
    successfully can they open and work on it in Word? Also, does the document library have any custom content types associated with it or does it just use 'Document'?
    I notice that there are other folks on the web that have run into this same problem and the similarity seems to be that they are either on SharePoint 2007 or have upgraded from 2007. Did this doc library start out as a 2007 library?
    What you might want to do is this: Make a site collection from scratch in 2013 (or find one that you know was created in 2013). Choose team site (or whatever you want) for the root web and set up the security the same way you have it on the malfunctioning
    library. Now, use windows explorer to copy and paste some of the documents to the new location. Be sure you recreate any needed content types. Now test it from the troubled user's computer.
    I'm thinking there may be something that is different about the library since it was migrated through various versions and updates since 2007. I've sometimes found that there can be problems (especially with user profiles but that's a different story) with
    things that go through this evolution.

  • Get/retreive managed metadata column value from Document Library using SharePoint 2013 JSOM

    Hi,
    I am trying to retrieve managed metadata column (NewsCategory) value in SharePoint 2013 Document library using JSOM.
    I get "Object Object" rather than actual value.
    I tried:-
    var newsCat = item.get_item('NewsCategory');
    alert(newsCat) //Displays [Object Object]
    var newsCatLabel = newsCat.get_label();
    var newsCatId = newsCat.get_termGuid();
    But, I get the error "Object doesn't support property or method get_label()"
    I also tried :-
    var newsTags = item.get_item(' NewsCategory ');
    for (var i = 0; i < newsTags.get_count() ; i++) {
    var newsTag = newsTags.getItemAtIndex(i);
    var newsTagLabel = newsTag.get_label();
    var newsTagId = newsTag.get_termGuid();
    Even now I get the error "Object doesn't support property or method get_count()"
    I have included " NewsCategory " in the load request:- context.load(items, 'Include(File, NewsCategory)');
    Any idea what the issue is? Do I have to add any *.js file using $.getScript?
    I added following .js files
    var scriptbase = _spPageContextInfo.webServerRelativeUrl + "/_layouts/15/";
    $.getScript(scriptbase + "SP.Runtime.js", function () {
    $.getScript(scriptbase + "SP.js", function () {
    $.getScript(scriptbase + "SP.Core.js", function () {
    Thanks in Advance,

    Hi Patrick,
    I already added those references. I just pasted the parts of script snippet in my initial post. To avoid confusion I am pasting here complete script.
    2.1.1.min.js"></script>
    <script type="text/javascript">
    $(document).ready(function(){
    var scriptbase = _spPageContextInfo.webServerRelativeUrl + "/_layouts/15/";
    $.getScript(scriptbase + "SP.Runtime.js", function () {
    $.getScript(scriptbase + "SP.js", function () {
    $.getScript(scriptbase + "SP.Core.js", function () {
    function getdata() {
    var context = new SP.ClientContext.get_current();
    var web = context.get_web();
    var list = web.get_lists().getByTitle('Documents');
    var camlQuery = new SP.CamlQuery();
    var filterCategory = 'Solutions';
    var IDfromTaxonomyHiddenList = 15;
    camlQuery.set_viewXml('<View><Query><Where><Eq><FieldRef LookupId="TRUE" Name="'+filterCategory+'" /><Value Type="ID">' + IDfromTaxonomyHiddenList +'</Value></Eq></Where></Query></View>');
    /*the above CAML query successfully gets all the list items matching the criteria including "NewsCategory" managed metadata column values
    But when I try to display the value it retrieved it ouputs/emits Object Object rather than actual values */
    var items = list.getItems(camlQuery);
    context.load(items, 'Include(File,NewsCategory)');
    context.executeQueryAsync(
    Function.createDelegate(this, function (sender, args) {
    if (items.get_count() > 0) {
    var listItemEnumerator = items.getEnumerator();
    while (listItemEnumerator.moveNext()) {
    var oListItem = listItemEnumerator.get_current();
    var file = oListItem.get_file();
    var name = file.get_name();
    var newsCat = oListItem.get_item('NewsCategory'); alert(newsTags.constructor.getName());
    alert(newsCat) //Displays [Object Object]
    var newsCatLabel = newsCat.get_label(); // Here it errors out with message "Object doesn't support property or method get_label()"
    var newsCatId = newsCat.get_termGuid();
    } //end while
    }//end if
    Function.createDelegate(this, function (sender, args) {
    alert('Request failed. ' + args.get_message() + '\n' + args.get_stackTrace());
    ExecuteOrDelayUntilScriptLoaded(getdata, "SP.Core.js");
    </script>
    In the above script "var name = file.get_name(); " gets the exact file name.
    But the line "var newsCat = item.get_item('NewsCategory');
           alert(newsCat) //Displays [Object Object]  rather than actual value.
    Issue resolved replace "oListItem.get_item('NewsCategory');" with oListItem.get_item('NewsCategory').get_label();"
    Thanks

Maybe you are looking for

  • Macbook Pro with external screen

    Hello guys! First my setup: Macbook Pro 2011 13" Low-spec. Acer 24" FullHD external screen. Apple keyboard. Wireless mouse. Now what i want to do with this is, i want to have my macbooks lid open, but the screen shut off, so i can use the great resol

  • 0FI_AR_4 & SPECIFICALLY BWFI_AEDAT

    Hi All, I have read so much about 0Fi_ar_4,but 1 doubt still prevails. A few information: 1.0Fi_ar_4 extractor in my project is still not minute based. 2.The extraction takes place after 2 GMT.Loading is always once a day. Confusion: I have understoo

  • JDBC Lookup in message mapping

    Hi Folks, in a message-mapping i use a jdbc lookup. i get this error, can anybody help me ? Put value [Plain exception:Problem when calling an adapter by using communication channel JDBC_MKA_Receiver_Lookup (Party: , Service: R3EREDATA, Object ID: 3a

  • Faster way to get my own DVDs onto my iPod or iMovie

    I've tried DVDxDV and checked out Handbrake. They are both very slow, about 5 hours for a 1 hour DVD. Does anyone know of software out there that will rip my DVDs (personal, no copyright) onto my Mac?

  • Inventory: Cannot find item in an organization

    Hi, In a R12 Vision instance, I am trying to find the item AS18456 in the organization M1-Seattle Manufacturing using the Organization Items form. But I am encountering the 'APP-FND-00698: Flexfield Segment combination not found' every time I try to