Umbraco - Try to read document properties programatically but always getting null

无人久伴 提交于 2019-12-12 01:04:28

问题


I am writing a console application to read content from my umbraco database. I am unable to get following simple code to work

        var doc = new Document(1081);
        Console.WriteLine("Package Id: {0}", doc.getProperty("packageId").Value);

There is a document in Umbraco and I have created content against that document. The content node is published and has id of 1081. The first line works fine and returns me the correct content node but second line fails to retrieve the property named packageId. There is a property with this name on the document type and I can see this value in the xml of the content node in cmsContentXml table in Umbraco database.

Is running this inside a console application a problem? I do not seem me to think so otherwise the first line of code would not have worked either.

来源:https://stackoverflow.com/questions/20358594/umbraco-try-to-read-document-properties-programatically-but-always-getting-nul

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!