Named properties for CALENDER items - calendar

I want to know whether I have to fetch PropertyID for PidLidAppointmentDuration using GetNamesFromIDs(), like the way we do for Named-Property.
http://msdn.microsoft.com/en-us/library/cc433490%28v=exchg.80%29.aspx
2.11 PidLidAppointmentDuration
Canonical name: PidLidAppointmentDuration
Description: Specifies the length of the event, in minutes.
Property set: PSETID_Appointment {00062002-0000-0000-C000-000000000046}
Property long ID (LID): 0x00008213
Data type: PtypInteger32, 0x0003
Here microsoft gives PropertyID right way. So can I use 0x8213 directly without calling GetNamesFromIDs(). More importantly, will 0x8213 work in every environment.
Thanks
Ramesh

This is not at all what it means: property id here is what you pass (along with the GUID) when calling GetIdsFromNames.

Related

Logic Apps - How to save a tracked property guid as string?

I want to track a guid value in LogAnalytics, using tracked properties, but I can't get it to be saved as a string (that is with suffix "_s" instead of "_g" for guid).
I've tried to convert it to string and to replace all the hyphens to empty string, but no luck.
It works fine if I concat the guid with another character, but I want to save the guid as it is of course.
Example, this does not work:
trackedProperties": {
"MessageId": "#{string(Outputs('MyAction').MessageId)}"
}
Anyone got an idea of how to solve this?
I think we need to refer to the official document to know the record type and properties.
So could you please check if the "messageId_g" is existed. And if still can't solve it, you can try to use another "Initialize variable" action and put your messageId in it and then tracked the property in "Initialize variable" action, it should be "_s".
Hope it helps~
To identify a property's data type, Azure Monitor adds a suffix to the property name. If a property contains a null value, the property is not included in that record. This table lists the property data type and corresponding suffix:
**RECORD TYPE AND PROPERTIES**
**Property data type Suffix**
String => _s
Boolean => _b
Double => _d
Date/time => _t
GUID (stored as a string) => _g

pattern for updating a datastore object

I'm wondering what the right pattern should be to update an existing datastore object using endpoints-proto-datastore.
For example, given a model like the one from your GDL videos:
class Task(EndpointsModel):
detail = ndb.StringProperty(required=True)
owner = ndb.StringProperty()
imagine we'd like to update the 'detail' of a Task.
I considered something like:
#Task.method(name='task.update',
path='task/{id}',
request_fields=('id', 'detail'))
def updateTask(self, task):
pass
However, 'task' would presumably contain the previously-stored version of the object, and I'm not clear on how to access the 'new' detail variable with which to update the object and re-store it.
Put another way, I'd like to write something like this:
def updateTask(self, task_in_datastore, task_from_request):
task_in_datastore.detail = task_from_request.detail
task_in_datastore.put()
Is there a pattern for in-place updates of objects with endpoints-proto-datastore?
Thanks!
See the documentation for details on this
The property id is one of five helper properties provided by default
to help you perform common operations like this (retrieving by ID). In
addition there is an entityKey property which provides a base64
encoded version of a datastore key and can be used in a similar
fashion as id...
This means that if you use the default id property your current object will be retrieved and then any updates from the request will replace those on the current object. Hence doing the most trivial:
#Task.method(name='task.update',
path='task/{id}',
request_fields=('id', 'detail'))
def updateTask(self, task):
task.put()
return task
will perform exactly what you intended.
Task is your model, you can easily update like this:
#Task.method(name='task.update',
path='task/{id}',
request_fields=('id', 'detail'))
def updateTask(self, task):
# Task.get_by_id(task.id)
Task.detail = task.detail
Task.put()
return task

GoogleAppEngine - query with some custom filter

I am quite new with appEnginy and objectify. However I need to fetch a single row from db to get some value from it. I tried to fetch element by ofy().load().type(Branch.class).filter("parent_branch_id", 0).first() but the result is FirstRef(null). However though when I run following loop:
for(Branch b : ofy().load().type(Branch.class).list()) {
System.out.println(b.id +". "+b.tree_label+" - parent is " +b.parent_branch_id);
};
What do I do wrong?
[edit]
Ofcourse Branch is a database entity, if it matters parent_branch_id is of type long.
If you want a Branch as the result of your request, I think you miss a .now():
Branch branch = ofy().load().type(Branch.class).filter("parent_branch_id", 0).first().now();
It sounds like you don't have an #Index annotation on your parent_branch_id property. When you do ofy().load().type(Branch.class).list(), Objectify is effectively doing a batch get by kind (like doing Query("Branch") with the low-level API) so it doesn't need the property indexes. As soon as you add a filter(), it uses a query.
Assuming you are using Objectify 4, properties are not indexed by default. You can index all the properties in your entity by adding an #Index annotation to the class. The annotation reference provides useful info.
Example from the Objectify API reference:
LoadResult<Thing> th = ofy.load().type(Thing.class).filter("foo", foo).first();
Thing th = ofy.load().type(Thing.class).filter("foo", foo).first().now();
So you need to make sure member "foo" has an #Index and use the now() to fetch the first element. This will return a null if no element is found.
May be "parent_branch_id"in your case is a long, in which case the value must be 0L and not 0.

Document status that depend on the user type object

I have the following objects: L1User, L2User, L3User (all inherits from User) and Document.
Every user can create the document but depending on the user type, the document will have a different status. So in case it's L1User, the document will be created with L1 status and so on:
Solution 1
Please note that after document is created, it will be saved in the database, so it should be natural to have a method create_document(User user) in Document object. In the method body I could check which type is the user and set manually appropriate status. Such approach seems rather not OOP to me.
Solution 2
Ok, so the next approach would be to have all users implement a common method (say create_document(Document doc)) which will set a status associated with the user and save the document in the database. My doubt here is that the document should be saved in it's own class, not the user.
Solution 3
So the final approach would similar to the above, except that the user will return modified document object to it's create_document(User user) method and save will be performed there. The definition of the method would be like this:
create_document(User user)
{
this = user.create_document(this);
this->save();
}
It also doesn't seems right to me...
Can anyone suggest a better approach?
I think that both Solutions 2 and 3 are ok from the OO point of view, since you are properly delegating the status assignment to the user object (contrary to solution 1, whare you are basically doing a switch based on the user type). Whether to choose 2 or 3 is more a matter of personal tastes.
However, I have a doubt: why do you pass a document to a create_document() method? I would go for a message name that best describes what it does. For example, in solution 3 (the one I like the most) I would go for:
Document>>create_document(User user)
{
this = user.create_document();
this->save();
}
and then
L1User>>create_document()
{
return new Document('L1');
}
or
Document>>create_document(User user)
{
this = new Document()
this = user.set_document_type(this);
this->save();
}
and then
L1User>>set_document_type(document)
{
document.setType('L1');
}
Edit: I kept thinking about this and there is actually a fourth solution. However the following approach works only if the status of a document doesn't change through its lifetime and you can map the DB field with a getter instead of a property. Since the document already knows the user and the status depends on the user, you can just delegate:
Document>>getStatus()
{
return this.user.getDocumentStatus();
}
HTH

EPiServer DDS Change Schema for type

I am storing a type in the EPiServer DDS that has a few properties such as string and guid. I now want to add a new property of type string to that type. How is it possible to get the DDS to recognise the new property added to the type and add it to the schema for the type in the DDS.
You need to remap the type to the store like this:
Let's say your class is called Car
var store = DynamicDataStoreFactory.Instance.GetStore(typeof(Car));
store.StoreDefinition.Remap(typeof(Car));
store.StoreDefinition.CommitChanges();
If you're then going to use the store instance directly after then do a refresh:
store.Refresh();
You can find more info about the DDS here:
http://world.episerver.com/Documentation/Items/Tech-Notes/EPiServer-CMS-6/EPiServer-CMS-60/Dynamic-Data-Store/
Paul Smith
Developer Evangelist
EPiServer
The next version of CMS / EPiServer Framework will ship with a PowerShell cmdlet to do this from a script.
For the CMS 6 version I suggest you add the code to the Global.asax or create an initialization module
(http://world.episerver.com/Blogs/Magnus-Strale/Dates/2010/2/Changes-in-the-initialization-system-from-EPiServer-CMS-6-RC1/)
You can first check if the type and store are aligned:
var store = DynamicDataStoreFactory.Instance.GetStore(typeof(Car));
if (!store.StoreDefinition.ValidateAgainstMappings(typeof(Car), false))
{
store.StoreDefinition.Remap(typeof(Car));
store.StoreDefinition.CommitChanges();
}
This way you only remap when needed.

Resources