I've created a SharePoint calendar with content types: Available and Unavailable. The "All Day Event",
"Recurrence", and "Workspace" fields are not available in the new content types. I need the All Day Event and Reccurence fields. I am not using the "Event" content type on this calendar.
Should the All Day Event and related colums be available on the new content types?
If so, what did I likely do wrong?
If not, how do I get the desired columns into the new content types?
Thank You
Are your content derived from the event content type though? I believe the event content type to be hidden, but creating your content types using a feature and by using the content type id hierarchy to have your Available / Unavailable content types derive from the sharepoint event content type would solve your problems. Remove any fields (site columns) you don't need.
Use the xml snippet below to create a derived content type. IMHO it is always best to first create a base content type derived from an out of the box sharepoint ctype when you plan on creating more than 1 version of that ctype.
<!-- 0x0102 is the sharepoint event content type's id,
00 is a splitter,
the rest is a guid that you generate, stripped of dashes and {}
i.e. {54646609-853E-4f28-B4F8-B6258DBFD632}
add 01, 02, etc. at the end to create ctypes derived from this base ctype-->
<ContentType ID="0x01020054646609853E4f28B4F8B6258DBFD632"
Name="Event Derived Base Content Type"
Description="This serves as a base for all your event ctype derived ctypes"
Group="Group the ctype should fall under in ctypes site settings page">
<FieldRefs>
</FieldRefs>
</ContentType>
<!-- by adding 01 you create a new, specific purpose ctype-->
<ContentType ID="0x01020054646609853E4f28B4F8B6258DBFD63201"
Name="Available"
Description="Your description"
Group="Name of group">
<FieldRefs>
</FieldRefs>
</ContentType>
<!-- same for 02 -->
<ContentType ID="0x01020054646609853E4f28B4F8B6258DBFD63202"
Name="Unavailable"
Description="Your description"
Group="Name of group">
<FieldRefs>
</FieldRefs>
</ContentType>
Related
I'd like to pass the Unix timestamp to a hit level eVar in DTM. I would assume I could pass some Javascript like this:
function() {
var now = new Date();
return now.getTime();
}
However, I am not sure where to pass it in DTM. Would this be passed in the "Customize Page Code" editor in the Tool Settings or somewhere else?
You can create a Data Element of type Custom Code. Name it something like current_timestamp or whatever. The code should not be wrapped in the function declaration syntax (DTM already wraps it in a function callback internally). So just put the following in the code box:
var now = new Date();
return now.getTime();
Then in your Adobe Analytics Tool Config (for global variables), or within a Page Load, Event Based, or Direct Call Rule, within the Adobe Analytics Config section. choose which eVar you want to set, and for the value, put %current_timestamp% (or whatever you named it, using % at start/end of it. You should see it show up in a dropdown as you start typing % in the value field).
Alternatively, if you want to assign the eVar in a custom code box in one of those locations, you can use the following javascript syntax e.g (assume eVar1 in example).
s.eVar1 = _satellite.getVar('current_timestamp');
Note that with this syntax, you do not wrap the data element name with %
One last note. This is client-side code, so the timestamp will be based on the user's browser's timezone settings. So for example, a visitor from the US and another visitor from China both visiting a page physically at the same time (server request at the same time), will show two different timestamps because they are in two different timezones.
This makes for some misleading data in reports, so make sure you break it down by other geo based dimensions, or do some extra math in your Data Element to convert the timestamp to a single timezone (e.g. convert it to EST). In practice, most people will pick whatever timezone their office is located in, or else what their server's timezone is set to.
I followed same steps that are mentioned in this question, to filter the push notification events based on custom properties set by outlook add-in.
Below is the resource link that I used while subscribing to push notifications.
https://outlook.office.com/api/v2.0/me/events/?$filter=SingleValueExtendedProperties%2FAny(ep%3A%20ep%2FPropertyId%20eq%20'String%20{00020329-0000-0000-C000-000000000046}%20Name%20cecp-7e248e5e-204e-4e2b-aa0f-788af20fc21c'%20and%20ep%2FValue%20ne%20null)
It's filtering the calendar items that are having custom properties set by add-in, irrespective of whatever custom property it is.
By looking at this resource link, we could say that no where we have mentioned the custom property name. But my add-in sets more than one custom properties to calendar item. I want to filter all calendar items that are having specific custom property. For example, My add-in sets any one of the below custom property to calendar based on business login.
Custom property 1:
var item = Office.context.mailbox.item;
item.loadCustomPropertiesAsync((result) => {
const props = result.value;
props.set("my_prop_one", "test_value_one");
props.saveAsync((saveResult) => console.log("Successfull"));
});
Custom property 2:
var item = Office.context.mailbox.item;
item.loadCustomPropertiesAsync((result) => {
const props = result.value;
props.set("my_prop_two", "test_value_tw");
props.saveAsync((saveResult) => console.log("Successful"));
});
Now I want to filter all calendar items that are having custom property my_prop_one.
EDIT 1:
As suggested by #Jason Johnston in one of the comments, I cross verified the property name and it's GUID using MFCMapi. Both property name and it's GUID values are correct.
MFCMapi data of custom property meetingsetby.
Then I collected data from MFCMapi and prepared the below url to filter calendar items that are having custom property meetingsetby and it's value webex.
https://outlook.office.com/api/v2.0/Me/Events?$filter=SingleValueExtendedProperties%2FAny(ep%3A%20ep%2FPropertyId%20eq%20'String%20{00020329-0000-0000-C000-000000000046}%20Name%20meetingsetby'%20and%20ep%2FValue%20eq%20'webex')
And below is the response from postman when I make the get call using above url.
As you can see, response has empty list even though there is one calendar item with custom property meetingsetby and value webex.
Then I set the SingleValueExtendedProperty to calendar item using outlook Rest API as described in this post. Below is the sample request data,
MFCMapi data of SingleValueExtendedProperty
Then I collected data from MFCMapi and prepared the below url to filter calendar items that are having singleValueExtendedProperty set in above step.
https://outlook.office.com/api/v2.0/Me/Events?$filter=SingleValueExtendedProperties%2FAny(ep%3A%20ep%2FPropertyId%20eq%20'String%20{6666AA44-4659-4830-9070-00047EC6AC6E}%20Name%20RestApiSingleValueExtendedProperty'%20and%20ep%2FValue%20eq%20'Set this property using REST API')
And below is the response from postman when I make the get call using above url.
As you can see, I can successfully filter the calendar items using singleValueExtendedProperty. But my requirement is filter calendar items that are having specific custom property set by my outlook web add-in.
Any suggestion/answers would be more than welcome.
Custom properties set by an add-in (using the CustomProperties interface) are not equivalent to normal MAPI named properties. Essentially what the add-in APIs do is take all of your "custom properties", serialize them as a JSON payload, then save it in a single MAPI named property, which will have the name cecp-{some guid}, and the property set GUID PS_PUBLIC_STRINGS {00020329-0000-0000-C000-000000000046}. The {some-guid} part of the name is equal to the Id of your add-in. This is all specified in MS-OXCEXT section 2.2.5.
So the end result here is that you cannot use $filter on the values you set in the CustomProperties interface, because there is no SingleValueExtendedProperty with that name and value. Instead, there is a single SingleValueExtendedProperty with the name cecp-{some guid}, with a string value that's the JSON serialization of ALL the custom props you set via the CustomProperties interface.
So how can you do what you want? Well, going back to your original URL, you can get all messages that have ANY properties set by your add-in by doing
$filter=SingleValueExtendedProperties/Any
(ep: ep/PropertyId eq 'String {00020329-0000-0000-C000-000000000046}
Name cecp-7e248e5e-204e-4e2b-aa0f-788af20fc21c' and ep/Value ne null)
Replacing the GUID after the cecp- with the GUID ID for your add-in.
But of course you want to find just the ones that have a specific property (meetingsetby) set to a specific value (webex). Unfortunately our API won't support substring searches when filtering the SingleValueExtendedProperties. So what you'd need to do is get all messages with any properties set by your add-in, then do your own filtering logic to find just the ones you want. So basically you would load them in memory, then check the value of that property yourself to find the ones you want.
You can make sure that the value of the property is included in the response by using an $expand clause. Something like this:
?$filter=SingleValueExtendedProperties/Any
(ep: ep/PropertyId eq 'String {00020329-0000-0000-C000-000000000046}
Name cecp-7e248e5e-204e-4e2b-aa0f-788af20fc21c' and ep/Value ne null)
&$expand=SingleValueExtendedProperties($filter=PropertyId eq 'String
{00020329-0000-0000-C000-000000000046} Name cecp-7e248e5e-204e-4e2b-aa0f-788af20fc21c')
So just started some work with an Umbraco 7 site.
The site has a custom media type. When adding media (including by dragging and dropping) and selecting this custom type the full path/url of the file added does not appear to be stored anywhere.
I've added a listener to the MediaService.Saved event and this is firing but within this method all the information I appear to have available is the id and the name of the file rather than the file itself.
I was expecting the "umbracoFile" property to be automatically populated but that doesn't appear to be the case. [I even tried editing my custom media type to have a property with alias "umbracoFile" but that just causes the Backend to crash].
Is there anyway to get the url/path of the file or to force Umbraco to set the "umbracoFile" property?
When you perform a drag and drop operation on a Folder Browser control (used in the Media section on Folders, or in the Media Picker dialog), Umbraco inspects the file type that you are dragging onto the upload area, and based on that determines the best media type to create. By default, for any known image type (png, jpg, gif, etc.) that is the Image media type, anything else is automatically assigned to the File media type.
When you hook into the MediaService.Saved event, you have access to the object representing that file in Umbraco Media, but it's already saved as a particular file type based on the description above (this has changed a little in 7.5.9 - see the below note). If you want to enable your own media type and have it set up for drag and drop, you need to dig a bit deeper.
Take a look at this: https://github.com/umbraco/Umbraco-CMS/blob/dev-v7/src/Umbraco.Web/Editors/MediaController.cs#L626-L638
Note: This applies to very recent versions of Umbraco only, as of 7.5.9 - your mileage may vary.
You may need need to look at setting the contentTypeAlias parameter of the post data when uploading the file to your preferred Media type, which may require you to create your own version of the Folder Browser data type.
Got something working in the end thanks to Robert's answer - it's fairly hacky but appears to work so I'm going to leave it here in case it helps anyone else.
Note that it uses a depreciated event handler and reflection to set private variables so I can't recommend that anyone else use it, but it might give people an idea where to start:
public void MediaService_Creating(IMediaService sender, NewEventArgs<IMedia> e)
{
int i = 0;
Type t = e.Entity.GetType();
FieldInfo[] fields = t.GetFields(BindingFlags.NonPublic | BindingFlags.Instance);
FieldInfo field = fields.First(x => x.Name == "_contentType");
MethodInfo findMediaTypeByAlias = ApplicationContext.Current.Services.MediaService
.GetType().GetMethod("FindMediaTypeByAlias", BindingFlags.NonPublic | BindingFlags.Instance);
IMediaType mediaType = (IMediaType)findMediaTypeByAlias.Invoke(
ApplicationContext.Current.Services.MediaService,
new object[] { Constants.Conventions.MediaTypes.Image });
field.SetValue(e.Entity, mediaType);
field = fields.First(x => x.Name == "ContentTypeBase");
field.SetValue(e.Entity, mediaType);
i = e.Entity.ContentTypeId;
}
The basic premise is to change the media type to Image whilst the media type is being created. By changing it in this way any extra properties for the Image media type get added and automatically populated. If a property on the custom media type shares an alias with one of the Image media type properties (such as umbracoFile) then that properties value is automatically populated meaning that it can be used in any Saving/Saved event listeners as required.
Am using Umbraco 4.11.10
Is there a standard way to create a document type property which when updated, automatically syncs with the content node name?
I know this can be done in the Properties section in the Name field but that field cannot be moved from the properties tab and it is a little out of the way - users get confused.
How is this usually done?
Wing
There are some special use umbraco field aliases. One is umbracoUrlName which will override the page url - just add it to your doctype and put it in whichever tab you want to change the url from.
EDIT
Another option would be to create a custom data type and use it to create a field that overwrites the node name. Add a text field as the UI of the custom data type; add an event that is fired whrn the textbox changes and update the name.
http://our.umbraco.org/wiki/reference/api-cheatsheet/modifying-document-properties
// Get the document by its ID
Document doc = new Document(node.Id);
// Get the properties you wish to modify by it's alias and set their value
// the value is saved in the database instantly!
doc.getProperty("name").Value = <input textbox value?;
// After modifying the document, prepare it for publishing
User author = User.GetUser(0);
doc.Publish(author);
// Tell umbraco to publish the document so the updated properties are visible on website
umbraco.library.UpdateDocumentCache(doc.Id);
The answer to question Cascading style sheets use "id" or "class" says for id's
Put an ID on an element if "it is the ..." (e.g. navigation)
and a further comment:
Because of this ids can only be used once (in the page) but elements can be classified multiple times. Also an element can only have one identifier but multiple classifications. However elements can be identified and classified.
With shadow dom, does the part about ids can be used once (in the page) still hold? For example, a simple way to grab elements in the component is to give each id's unique to the component and query them:
In html:
<input id="amount" placeholder="Amount" on-change="{{recalc}}"></input>
<input id="term-years" placeholder="Term (yrs) e.g. 30" on-change="{{recalc}}"></input>
<input id="rate" placeholder="Interest Rate" on-change="{{recalc}}"></input>
In Dart code:
termYearsElm = shadowRoot.querySelector('#term-years');
amountElm = shadowRoot.querySelector('#amount');
rateElm = shadowRoot.querySelector('#rate');
In playing with this, multiple instances of the component do not conflict. Is this approach safe or a bad idea? If it is safe then have the rules for ids have changed?
Yes it is perfectly legitimate to use an ID on an element of a component as long as it is 1) Unique to that component, and 2) The component has a shadowDOM. The shadowDOM encapsulates your components from each other. Thus you can have a component with id rate and it is used only once within that component. Even if you use that component multiple times within the same page the id's are encapsulated from each other.
Just a quick FYI as well, you can also use the $[] accessor for a shortened form. Dart code:
termYearsElm = $['term-years'];
amountElm = $['amount'];
rateElm = $['rate'];