Module Creating/Retrieve dynamic field Value
Hi,
I have already created Dynamic Data field with values like or used below API
sf.Documents().GetManager().Provider.SuppressSecurityChecks = true;
sf.Document().CreateNew().Do(item =>
item.Parent = sf.DocumentLibraries().Where(l => l.Title == ModuleName).Get().FirstOrDefault();
item.Title = title;
item.UrlName = title + "_Application";
item.SetValue("id", id);
item.SetValue("FullName", "SitefinityCMS");
).Publish();
and i want to retrieve the FullName Column value i.e SitefinityCMS using API.
Please let me know how to get those values as soon as possible.
Hi Mohammad,
There is DataExtension method GetValue that you can use to get the value of your custom field.
Greetings,
Ivan Dimitrov
the Telerik team
Hi
Thanks for valuable reply.
Please explain me little more with syntax then i can understand well.
Hello ,
Here is a sample
var manager = LibrariesManager.GetManager();
var id =
new
Guid(
"6e8230d5-9ba6-43ed-9aaa-4fc7de1c76c3"
);
var item = manager.GetItem(
typeof
(Image), id)
as
Image;
var value = item.GetValue(
"FullName"
);
Hi
If i try that code i am getting the following error.
var item = manager.GetItem(
typeof
(Image), id)
as
Image; this line gives
You are trying to access item that no longer exists. The most probable reason is that it has been deleted by another user.
Please solve my problem
Thanks
Hello Mohammad,
Most probably you are not passing an valid ID of the item.
Kind regards,
Ivan Dimitrov
the Telerik team
HI
Thanks for your express reply.
I got the solution
Hi
I can get value dcs.GetValue("ID").Equals("IDvalue")
is it possible to do
dcs.GetValue("Date"). =< (Equals or Greater then) ("DateValue")
Hello Jmr,
GetValue returns an object and this is why you can use Contains directly. To make comparison by other parameters you need to cast the object ( for instance to string) and then use proper expressions.
Best wishes,
Ivan Dimitrov
the Telerik team
Hi,
If you have a ContentItem how to you retrieve a dynamicfield for it?
Cheers,
Seth
Hello ,
There is extension method GetValue("yourfield") of the content item .You should have reference to DataTelerik.Sitefinity.Model.
Regards,
Ivan Dimitrov
the Telerik team
Hi Ivan,
I tried to use:
var manager = LibrariesManager.GetManager();
var id =
new
Guid(
"6e8230d5-9ba6-43ed-9aaa-4fc7de1c76c3"
);
var item = manager.GetItem(
typeof
(Image), id)
as
Image;
var value = item.GetValue(
"FullName"
);
Hello ,
Have you added using Telerik.Sitefinity.Model;
Best wishes,
Ivan Dimitrov
the Telerik team