Copied to clipboard

Flag this post as spam?

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


  • Simon Kibsgård 62 posts 73 karma points
    Aug 27, 2009 @ 14:45
    Simon Kibsgård
    0

    deleting a PropertyType and all data stored with them

    Hi

    I'm looking to delete a great deal of data and a PropertyType on a document type, but I need help.

    The case: I have a document type with the alias "user". It has a property of the property type "noderelations" which is a derivation of the "ultimate picker" propertytype. I have a lot of documents with of "user" document types with a lot of "noderelations" on each. At a certain point I would like to delete all this data and alter the "source node" of the "noderelations" property type. I figured the easiest way would be to delete the PropertyType and thereby dumping all data using it, and then create a new "noderelations" with another "source node" for it.

    But I get a System.NullReferenceException on an object when I get to the pt.delete() method. 

    Can anyone tell me the way to do it or perhaps show me another way of accomplishing the above case problem?

    The Code:

    PropertyType pt = new PropertyType(DocumentType.GetByAlias("user").getPropertyType("noderelations").Id);
    pt.delete();

    Thanks a lot!

     

  • Simon Kibsgård 62 posts 73 karma points
    Aug 28, 2009 @ 10:46
    Simon Kibsgård
    0

    I have debugged, even with the umbraco source code and found that It is first when the SQLHelper is trying to delete from the dbo.cmsPropertyType table, that the exception is thrown. Anyone?

Please Sign in or register to post replies

Write your reply to:

Draft