Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Sherry Ann Hernandez 320 posts 344 karma points
    Nov 14, 2011 @ 07:48
    Sherry Ann Hernandez
    0

    is there a way of importing property data to umbraco content?

    Hi,

    We have a multilingual website and we are managing the content for our meta keywords, meta descriptions and meta titles in different language also (11 languages).

    What I need is to have an excel file that contains all this translation and just have an import button in umbraco to populate the 3 properties (meta keywords, meta descriptions, meta titles)

    Sherry

  • Richard Soeteman 4045 posts 12898 karma points MVP 2x
    Nov 14, 2011 @ 09:09
    Richard Soeteman
    0

    Hi Sherry,

    Depending how you've setup the structure you might want to check-out CMSImport PRO. This allows you to Import content from and Excel file.

    Best,

    Richard

     

  • Adi 17 posts 36 karma points
    Nov 18, 2011 @ 17:50
    Adi
    0

    Hi Sherry

    I used code below to import from excel

    if (uploadFile.HasFile)
                {
                    string strFile = MapPath("\\ExcelData\\" + uploadFile.FileName);

                    uploadFile.SaveAs(strFile);

                    string strConn = string.Format(@"Provider=Microsoft.Jet.OLEDB.4.0;Data Source={0};Extended Properties=Excel 8.0", strFile);
                    OleDbConnection con = new OleDbConnection(strConn);
                    OleDbDataAdapter da = new OleDbDataAdapter("select * from [Sheet1$]", con);
                    DataTable dt = new DataTable();
                    da.Fill(dt);
                  
                    StringBuilder sb = new StringBuilder();
                    sb.AppendFormat("<p>input file: {0}</p>", strFile);
                    foreach (DataRow dr in dt.Rows)
                    {
                        DocumentType dct = new DocumentType(1068);
                        umbraco.BusinessLogic.User u = new umbraco.BusinessLogic.User(0);
                        int parent = 1073;
                        Document d = Document.MakeNew(dr["name"].ToString(), dct, u, parent);
                        d.getProperty("price").Value = int.Parse(dr["price"].ToString());
                        d.getProperty("category").Value = 6;
                        d.getProperty("description").Value = dr["description"].ToString();

                        d.Publish(u);

                        umbraco.library.UpdateDocumentCache(d.Id);

                        sb.AppendFormat("{0}<br>", dr["name"]);
                    }

                    divTest.InnerHtml = sb.ToString();

                }

        }

     

  • Sherry Ann Hernandez 320 posts 344 karma points
    Dec 01, 2011 @ 08:23
    Sherry Ann Hernandez
    0

    Hi Adi,

    Did you create a seperate .NET project for this uploader or you put it inside the umbraco project folder? Because i'm having a problem on this line.

    Document d = new Document(1234);

     

  • Adi 17 posts 36 karma points
    Dec 01, 2011 @ 20:19
    Adi
    0

    Hi Sherry

    I created a seperate dot.net project and this in code behind of a user control. I dont know whether i can upload a zip file here. If you wish i can forward the full project but don't have your email.

    bye

     

Please Sign in or register to post replies

Write your reply to:

Draft