+1-888-365-2779
Try Now
More in this section

Forums / Developing with Sitefinity / Understanding how Documents/Document Information is stored

Understanding how Documents/Document Information is stored

6 posts, 1 answered
  1. Karl
    Karl avatar
    45 posts
    Registered:
    18 Jun 2009
    05 May 2011
    Link to this post

    Hi,

    I’m looking to move content from our current intranet in to our new intranet which uses Sitefinity.  I’ve noticed when I use the Zip functionality it uses the filename as the title. What I was hoping to do is run some sql  to change this.

    When I change the Key Value “Name” row  Short text column to some new text and save it, this is displayed on the below url in View mode but when I go to edit mode it has the old value? Is this stored in another table? I’m puzzled.

    sitefinity/admin/Modules.aspx?module=Libraries&route=LibrariesControlPanel.LibraryItemsView.LibraryItemEdit&ParentId=8009c2a8-0935-44f7-a718-9c31d3664391&Param=ce2c14fa-5ff0-40dc-a15b-b97ecce90af5&RadUrid=1eb2e410-2557-4f6e-a2a9-c4c732b7bf2c

    Thanks
    Karl

  2. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    25 Nov 2016
    06 May 2011
    Link to this post
    Hi Karl,

    You should better use Generic Content API to change the tile and any other metadata. You have to get the item into transaction, update it and save it

    var manager = new ContentManager("Libraries");
    var item = manager.GetContent(itemID);
    manager.SetMetaData("Name", "MyNewName");
    manager.SaveContent(item);

    Greetings,
    Ivan Dimitrov
    the Telerik team
    Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  3. Karl
    Karl avatar
    45 posts
    Registered:
    18 Jun 2009
    09 May 2011
    Link to this post
    Hi,

    I have over 5000 documents to go through. Can I do this in a console app? Or can you advise of another way?

    Thanks
  4. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    25 Nov 2016
    09 May 2011
    Link to this post
    Hi Karl,

    The metadata is per content item. You can create a console application that refers web service

    http://www.sitefinity.com/blogs/ivandimitrov/ivanposts/10-01-22/implementing_scheduled_services_in_sitefinity_3_x.aspx

    All the best,
    Ivan Dimitrov
    the Telerik team
    Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  5. Karl
    Karl avatar
    45 posts
    Registered:
    18 Jun 2009
    28 Jun 2011
    Link to this post
    HI,
    Am I missing something in the below to change the title of a document: I've upload a video here http://screencast.com/t/8zxSy85FqM  As you can see its changed the title on the one tab but when you go to edit it refers to the orginal name.

    Thanks
    protected void Page_Load(object sender, EventArgs e)
      {
          ChangeTitle();
      }
      private LibraryManager libraryManager = new LibraryManager();
      private Guid GetLibraryID(string libraryName)
      {
          return libraryManager.GetLibrary(libraryName).ID;
      }
      private void ChangeTitle()
      {
          // IList allDocs = manager.GetContent();
          IList allDocs = libraryManager.GetContent(0,0, "", this.GetLibraryID("_test"));
          foreach (IContent docItem in allDocs)
          {
              string docTitle = docItem.GetMetaData("Name").ToString();
              Response.Write(docTitle + "|" + docItem.ID);
              if (docTitle == "Deal Sheet Parts List 12")
              {
                  IContent ItemInTransaction = libraryManager.GetContent(docItem.ID) as IContent;
                  ItemInTransaction.SetMetaData("Name", "My filename");
                  libraryManager.SaveContent(docItem, Telerik.Cms.Engine.ContentStatus.Published);
              }
          }
      }
  6. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    25 Nov 2016
    28 Jun 2011
    Link to this post
    Hi Karl,

    Please use the staged version of the content item - StagedContent.

    Kind regards,
    Ivan Dimitrov
    the Telerik team
    Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
    Answered
Register for webinar
6 posts, 1 answered