Posts

Microsoft Flow PowerApps Projects Time Management Apps - Part 1

Image
Goal is to be able to manage how much time (in hours and minutes) the company spent each month. Each Employee should write down when he started and when he finished, and calculate the time.  At each period of time we should be able to get a report of total time spend per client. 
Design: 
Data will be 2 SharePoint lists, one for clients names, other for the time spent.  List 1 is Title only for client name.  List 2: Title - client nameCreated - start timeCreated By - employeeEndTime - end time ☺TotalTime - calculated field for time (=TEXT(EndTime-Created, "hh:mm"))
App1 - Employee chooses client, has 2 buttons, start and end App2 - Manager can choose month and gets a list of clients with their total time
Lets start, SP as states
App1

Drop "Items" Connected to SPList and "Value" to Title. Button Start to Flow is very simple, create a sharepoint list item with title of selected client. Since i wanted some message in the app i had the flow to return some answer with the…

Microsoft Flow save email attachment with Hebrew Letter to OneDrive or SharePoint

Image
Theoretically you could just use the OOTB template to save a GMAIL to SHAREPOINT


But... As always with MS, nothing is really that simple. All you need to break this flow is a special Character...


So here starts a journey to clean special characters, and i followed this blog post.

My spec was to create some Folder under the default Documents Library of a modern Team Site, and each attachment sent to a specific Gmail account, to be saves in a sub-folder with the sender's name, and another sub-sub-folder with the subject name

https://tenant.sharepoint.com/sites/my-team-site/Documents/emails Attachments/Sender Name/email subject/file name.ext

Playing with Flows, I 1st learned that in order for the flow to be triggered WITH attachments you must change "Has Attachments" and "Include Attachments" to "Yes", both under advanced options under "When a new email arrives" event


Now we can start talking about the actual flow logic

Part 1 - Define Array of …

Sharepoint Online SPFx Search Rest Api 403

Image
In case you develop an SPFx and you try to use RestApi for Search (or maybe also with the SP Rest) and you get 403, this in because your Webpart is running in his own scope, under an IFRAME.


The solution is to dynamically take your Absolute Url letfilesQuery = this.context.pageContext.web.absoluteUrl;
Every SPFx Webpart has his own SPPageContextInfo.
P.S. In case you choose to user SPHttpClient, you need 2 things to get over your 500 error: 1. use Default configuration (that should be v3 or v4) 2. change Accept header odata part to verbose
this.context.spHttpClient.get(filesQuery, newSPHttpClientConfiguration({}),       { headers: { Accept:"application/json;odata=verbose;charset=utf-8" } })         .then((response: SPHttpClientResponse) => {   response.json().then((responseJSON: any) => {   console.log(responseJSON);  //your code ...         });         }); 

Windows 10 Microphone not working

Start -> Settings -> Sound
under "Input" find "Manage sound devices" link
under "Input devices", click the devices and enable them

How to get RSS feed to Sharepoint List with Flow Automation

Image
3 simple steps - Recurrence,  RSS, Apply to each with some Composes

1 - Recurrence
Just state the recurrence of querying the feed


2 - Use the RSS connector, which actually just get the JSON array of the items :)
(at least in my case)


3 - Apply to each with some Composes

What can't be seen in the image is the formula, for each composite the formula is the same appart from the json field value, here "publishDate", place that in the "Expression" side of the "add dynamic content" and click "OK"

items('Apply to each')?['publishDate']
which apparently can be also be done with

item()?['User ID 1']

And create the SP item



P.S.
In order have distinct value items I set the SP list Title columns to force distinct values, it then shows an error for each attempt to create duplicate value















Web Api Create method with multiple parameters

Also, how to overload a method, say GET or PUT?

Well, lets start that with simple settings, you can't. Too many resources with partial examples makes you sometimes believe that it should be that simple (and maybe it should?), while its not.

It's also not that complicated...


Part 1 - understanding default design

When you create a new Web Api project (in vs 2017 Web Application -> empty, mark web api) you get basically nothing but the "WebApiConfig.cs" withing the "interesting" line is
routeTemplate: "api/{controller}/{id}",

And that means that whatever controller you create by default can only have it's 1st parameter, as in the url part, as "id". You cant create a method sending something like "string name".

Next step will be creating a controller class (with the (v2.1) in the end) and you will always get the suggestion of "ValuesController1". You cannot have the end of the controller name other than "Control…

How to access ngFor variable from child component or directive

the answer is ViewContainerRef

when you inject it into your constructor it has so much data in it. the ngFor data is in
this.vc['_view']['context']['$implicit']
directive full example

@Directive({
    selector:'td'
}) exportclassAddInvAmountBtnDirectiveimplementsAfterViewInit {
  el:HTMLElement constructor(ref:ElementRef, privatevc: ViewContainerRef) { this.el = ref.nativeElement   }

  @HostListener('click', ['$event']) tdClick(ev: Event){ console.log('vc._view.context.$implicit',
         this.vc['_view']['context']['$implicit']); ev.stopPropagation()   }
}