Sharepoint Rest Api

Working with the SP Rest Api i found some basics that are here to remember.

get by title
var u = "/sites/newportal/_api/Web/lists/getbytitle('Site Pages')/items"

select person field
u += "?$select=Title,Assigned_x0020_To0/Name,FileRef,FileDirRef" +

get folder
var u = "/sites/newportal/_api/Web/GetFolderByServerRelativePath" + 

but to really get a person data by folder in site pages i had to use search

var u = "/_api/search/query?" +
            "querytext='ParentLink:NewEmp'" +

SharePoint Group Display Templates [Grouping]

the questions...

How to Group Search Results Using Default Display Templates?

Grouping search results with display templates for the CSWP?

How to Define a Custom Group Display Template (GroupTemplateId)?

and the answer is a sad one...


Well, 1st create yourself a Group Display Template file, just take the default "group_xxx.html" from the "Search" or "Content Search" Folders, whatever you are using.

After adding it to the Master Pages, you can't add it via JS, you MUST download a copy or you Search WebPart (export) and change the value in "GroupTemplateId" to your group JS file.

Now at least you have a CSWP with you own group.html/js file.

So I've never really payed attention but in our Controls Display Templates the rendering part is in _#= ctx.RenderGroups(ctx) =#_ , GROUPS, not items.

This actually ALWAYS going through a group rendering function, and hey, i want to use it. but how?

nothing... NOTHING is the documentation (THX M…

SharePoint display templates ERROR: hexadecimal value 0x3C, is an invalid attribute character

its an error about a "<" or ">".

you might have user "Enter" for an element with too many attributes like this

<a href="value......."

collapse it to this
<a href="value......."  class="value......."  id="value......."  data-toggle="value.......">

SyntaxError: expected expression, got '&'

SyntaxError: expected expression, got '&'

this belongs to the if syntax "a = b ? c : d";

probably the problem is in the 'b'

Adding a Full Task [PlannerTask] to 365 planner

Today i created an angular app to interact with MS 365 Planner. I tried to add a task. The example @MS - create task works fine
{"planId":"xqQg5FS2LkCp935s-FIFm2QAFkHM","bucketId":"hsOf2dhOJkqyYYZEtdzDe2QAIUCR","title":"Update client list","assignments":{"fbab97d0-4932-4511-b675-204639209557":{"@odata.type":"#microsoft.graph.plannerAssignment","orderHint":" !"}},}
Adding a details object was great until i was trying to add some checklist items.
My app gave this error [400]:

message:"Schema validation has failed. Validation for field 'Title', on entity 'Task' has failed: A non-null value must be specified for this field."

Well, this is the end of the story, since after everything went well in the Graph Explorer my app still gave the same error, until i notices that the Content-Type was application/x-www-form-urlencoded.

The Fix is

Angular Dual App

or more exact run separate root components.

you can just add multiple components to the bootstrap: [ decorator.

then you can run as many apps as you want.

bootstrap: [   AppComponent,   LoginComponent,   ContactComponent,   TableComponent, ]
<body>   <app-welcome></app-welcome>   <app-login></app-login>   <app-table></app-table>   <app-contact></app-contact> </body>

in Angular 4 Services has scope. if we create a service at the App.Module Scope, it will share all it's info will all apps, all comps, but if you create a service, and declare it inside a providers:[ decorator, inside a specific Component, then all child components will share the same instance, but siblings comps declaring the same service will have their own instance.

MatDatePicker Errors

if you get this one

Can't bind to 'matDatepicker' since it isn't a known property of 'input'

then you're missing some modules in your import, the datepicker has many dependencies, and i didn't tried to find them, so just fill in the long long list in the plnk.

for this one

MatDatepickerToggle.html:1 ERROR TypeError: Cannot read property 'disabled' of undefined

you have some miss-spell like [for]="pickerFrom"vs#pickerFrom