2017年1月27日 星期五

[Sharepoint] People picker cannot recoginize domain user

 Sharepoint    AD   People picker


▌Issue


Issue: The people picker in Sharepoint could not recognize the some domain users.


How to solve it


Find the administration cmd tool of SharePoint Server

First, we have to find the stsadm.exe tool, it’s located in

C:\Program Files\Common Files\Microsoft Shared\web server extensions\{version#}\bin


Search the available domain users

Use the following command to analyze the AD users in certain domain.

$> stsadm -o setproperty -pn peoplepicker-searchadforests -pv "{domain name}" -url http://sharepoint-portal/


Done :)


Reference




2017年1月24日 星期二

[Sharepoint] Webpart embeds SAP Netweaver problem

 Sharepoint   Webpart   Embedded webpage   iframe

Trouble


由於SAP Netweaver Portaljavascript預設是以目前頁面為TOP frame的情況去撰寫,所以在使用Sharepoint Webpartiframe再做一次內嵌時,就會引發一些語法的錯誤判斷

例如我這一次碰到, Webpart會一直卡在NetweaverLoading畫面



Fiddler看一下封包, 發現Webpart iframe 從顯示LoadingGIF動畫轉址到SAP Portal頁面顯示LoadingGIF動畫轉址無窮迴圈!!






How to solve it


SAP Netweaver 7.3之前的版本

SAP Netweaver AP Server以下路徑
\usr\sap\<SID>\<NO>\j2ee\cluster\server0\apps\sap.com\irj\servlet_jsp\irj\root\WEB-INF\

開啟 web.xml,加入一個新的alias設定

<init-param>
     <param-name>
          portal/interop
     </param-name>
     <param-value>
          anonymous=0,proxy=0,low_bandwidth=0,include_in_url=1, include_application_name_in_url=1,nested_window=1
     </param-value>
</init-param>

B06然後調整要內嵌的URL,例如 :

http://XXX/irj/servlet/prt/portal/prtroot/...  改為

http://XXX/irj/portal/interop/prtroot/...


SAP Netweaver 7.3()後的版本

預設已經加入interopalias,所以只要確定有加上 nested_window=1 的參數值即可。
內嵌的Netweaver URL仍是比照上面做調整


如此就可以正確在Sharepoint Webpart內嵌SAP Netweaver的網站內容。


Reference


[Sharepoint] Use webpart to embed other website pages

 Sharepoint   Webpart   Embedded webpage   iframe

Introduction


簡單介紹如何使用Sharepoint來內嵌其他網站的內容~


Environment

Sharepoint 2013



Implement


新增應用程式




選擇應用程式類型

您可以選擇如下圖預設的應用程式類型(只截圖部分),因我們目標在於內嵌其他網站內容,這邊我選擇「文件庫」作為示範。






▋輸入名稱




Results

選擇右上角工具icon→【編輯頁面





移除預設網頁組件

選擇預設Webpart右上方的下箭頭→【刪除




移除預設網頁組件

再次選擇工具icon→【編輯頁面





新增Webpart





加入媒體及內容→【網頁檢視器







加入其他網站(網頁)URL




完成之後,可直接點選左上角的【停止編輯】關閉設計頁面。


外部網站無法被iframe內嵌

如果內嵌的網站有設定Http response header : X-Frame-Options
Sharepoing Webpart則不會顯示外部網站內容,並會出現如下錯誤訊息

Refused to display 'http://xxxxxxxx' in a frame because it set 'X-Frame-Options' to 'SAMEORIGIN'.

解決方式:
移除此Http response header
設定可允許內嵌之URL
同源(Same origin)




SSO (Single Sign On)

如果內嵌的網站也是Windows帳號認證,這時候請開啟內嵌網站的Windows驗證,即可達到SSO的目的。







2017年1月13日 星期五

[Angular] Deploy to Firebase

 Angular    Firebase CLI     Firebase    Build    Deploy





Introduction


Let’s learn how to deploy our Angular2 website to Firebase hosing via Firebase CLI.



Environment


Angular CLI 1.0.0-beta.19.3
Firebase CLI 3.2.1


How to Deploy


Install Firebase CLI

$> npm install -g firebase-tools



Build

Build our Angular2 website in Angular CLI by this command.

$> ng build --prod

PS. The ready-to-deploy files are in /dist


Deploy

Before deployment, we should set up the Firebase options.

Type

$> firebase init

for setting the following options,

1.What Firebase CLI features do you want to setup?

 Choose Hosting.

2.What Firebase project fo yu want to associate as default?

 Select your default project.

3.What file should be used for Database Rules?

 Use default file: database.rule.json, which will be initialized with the settings in the Firebase database rules.

4.What do you want to use as your publis directory?

 Of course that will be “dist”.

5.Configure as a single-page app (rewrite all urls to /index.html)?

 Choose yes will make every route shows the url as http://XXX/index.html but not the route url in the browser.

6.File dist/index.html already exists. Overwrite?
 
  No


The above settings will create 3 files in your website,

1.database.rules.json
2.filebase.json
3..firebaserc

Notice .firebaserc keeps the default Firebase project name associated with our website.


Okay, everything is done, use the command to deploy.

$> firebase deploy



And we will successfully deploy our website to Firebase J




Make the website offline

$> firebase hosting:disable








Reference




2017年1月12日 星期四

[ASP.NET Core X Angular] (14) - Server side rendering for SEO

 Angular    ASP.NET Core     SEO     Server side rendering    Angular Universal




Introduction


We take great advantage of better UX and performance in SPA (
Single Page Application), but dealing with SEO is a headache since SPA doesn’t perform well against the indexing of web crawler.

The best way for building a SEO friendly SPA is using server-side rendering.

In my previous article,

We can render a MVC view from server side in angular component, but honestly, this way has some integration issues and is not easy to maintain.

So we will use Angular Universal and Microsoft.AspNetCore.SpaServices to build a server-side-rendering single page app.


Related articles


Angular Universal

Angular Universal does server-side-rendering and serves the single pages as what they behave on the client side.

PS. There will be a chance (?) for integrating
Angular Universal to Angular CLI, follow issues: #1050, #3013.
 
Here are some ways to use Angular Universal quickly,



Microsoft.AspNetCore.SpaServices

This package enables the following functions for building SPA with Angular 2, React, Knockout… in ASP.NET Core.




▌Implement


Since it’s fairly complex to integrate Microsoft.AspNetCore.SpaServices and Angular Universal, there is a quick way to get started with Angular2 server-side rendering on ASP.NET Core: aspnetcore-spa generator.


Install

webpack

$> npm install -g webpack


aspnetcore-spa generator

$> npm install -g yo generator-aspnetcore-spa




Create New project

Under an empty folder, use the following command to create a new project.

$> yo aspnetcore-spa


And execute  dotnet restore  and  npm install after the project is created.






PS. You can also create the SPA project by installing ASP.NET Core Template Pack extension.


Server side rendering

Okay, take a look the view-source of our previous non-server-side-rendering app in the browser.








And now we implement the same codes on the template generated from aspnetcore-spa generator. With Angular Universal and ASP.NET Core SPA Services, we have a server-side rendering app now! 





Hot module replacement (Demo)





Summary


With Angular Universal, we can quickly build a SEO friendly Single page application with Angular2. Also Angular Universal will support more backend frameworks in the near future!


Angular Universal was originally built to work with a node.js back-end. There are adapters for most popular node.js server-side frameworks such as Express or Hapi.js. In addition to node.js, however, Angular Universal has ASP.NET Core support. In the near future we hope to add support for Java, PHP and Python.

- From Angular Universal document




Reference