I previously raised a question on "How to access content Item field programmatically and storing field values manually?"
I'm trying to access the content item field which I created from admin UI,I assigned my BlogPost a field named TaxonomyField.
Now using XML-RPC web services, on each content item create request, I want to store field values in database?
my field of taxonomy in BlogPost is treated as BlogPostPart...can I find any similar example in Orchard?
this is the original code from XMLRpc Handler.cs
private int MetaWeblogNewPost(
IUser user = ValidateUser(userName, password);
// User needs permission to edit or publish its own blog posts
_authorizationService.CheckAccess(publish ? Permissions.PublishBlogPost : Permissions.EditBlogPost, user, null);
BlogPart blog = _contentManager.Get(Convert.ToInt32(blogId));
if (blog == null)
throw new ArgumentException();
var title = content.Optional("title");
var description = content.Optional("description");
var slug = content.Optional("wp_slug");
var category = content.Optional("categories");
var blogPost = _contentManager.New("BlogPost");
blogPost.As().Text = description;
blogPost.As().Owner = user;
blogPost.As().Container = blog;
blogPost.As().Title = title;
blogPost.As().Slug = slug;
blogPost.As().Path = blogPost.As().GetPathWithSlug(blogPost.As().Slug);
// this is where I want to access the BlogPart Taxonomy and update the record as the record is already have been create
// as _contentManager.Create...
var publishedUtc = content.Optional("dateCreated");
if (publish && (publishedUtc == null || publishedUtc <= DateTime.UtcNow))
foreach (var driver in drivers)
Bertand Answer was:
@Aamir: it would be best to post that on the discussions forum, so that others can find it and benefit from any answers. In a nutshell, yes you can access fields. The easiest is to cast the ContentItem to dynamic and access the field through something
like item.ThePartThatHasTheField.TheField.TheFieldProperty. S
Still need more information...