Saturday, September 13, 2014

SharePoint : Create list items in external list using SharePoint Workflow

שלום חברים,

במאמרים הקודמים שפרסמתי הצגתי פתרון לקישור בין Oracle ל-SharePoint בעזרת שירות BCS (מאמר : SharePoint : Connect to Oracle Using WCF via BCS) ולאחר מכן הקמת External Content Type שאמון על מיפוי הנתונים ל-SP (מאמר: SharePoint : Connecting to WCF Service as ExternalContent Type).

אחרי שראינו שהכל עובד Perfect וניתן לסנכרן נתונים באופן דו-כיווני ל-SP ול-Oracle התברר שהלקוח רוצה לייצר טפסים דינמיים עם שדות מורכבים בעזרת InfoPath, מה שלא מתאפשר ביצירת External List מ-External Content Type. היינו בישורת האחרונה לפרויקט והתחלנו לחשוב על פתרון יצירתי שייתן מענה הולם לבעיה ושאינו דורש פיתוח.. אז .. שימוש ב- SharePoint Workflows נראה לי הפתרון הכי נכון לבעיה שלנו.

התחלנו ביצירת רשימת SharePoint (Custom List) שמורכבת משדות מורכבים כמו People Picker, שדה אפשרויות כ-Dropdown ועוד.

לאחר מכן פתחנו את הרשימה כטופס ב-InfoPath (לחיצה על פקד Customize Form ב-Ribbon) עיצבנו את הטופס כמו שאנחנו רוצים, שמרונו והעלנו אותו ל-SP.

לאחר מכן יצרנו Workflow  דרך SharePoint Designer :

.1 פתחו את SharePoint Designer והתחבר לאתר שלך.

.2 לחצו על "זרימות עבודה" בתפריט הצדדי



.3 צרו זרימת עבודה מסוג "רשימת זרימת עבודה" , בחרו "רשימת זרימת עבודה" מה-Ribbon ובחרו את הרשימה שזרימת עבודה תהיה מקושרת אליה.



.4 תנו שם ותיאור לזרימת העבודה ולאחר מכן לחצו על אישור.



.5 לחצו בתוך "שלב 1" ולחצו על הלחצן "הפעולה" בRibbon. בחרו "צור פריט רשימה"



.6 פעולת זרימת עבודה חדשה נוצרה בתוך "שלב 1". לחצו על "רשימה זו" ובחרו את הרשימה החיצונית כדי ליצור הפריט החדש בה.



.7 כאשר תיבת הדו-שיח נפתחת, בחרו את הרשימה החיצונית. לחצו על לחצן "הוסף ..." ומפה את השדות מהרשימה החיצונית למאפייני ומשתני זרימת העבודה.



.8 לחצו על אישור כאשר תסיימו. שלב 1 בזרימת העבודה צריך להיראות כמו בתמונה למטה



.9 אפשר להוסיף עוד פעולות לזרימת עבודה ולאחר מכן לשמור ולפרסם אותו לרשימה.



לאחר שיצרתם את ה-Workflow חשוב לוודא של-User שמריץ את ה-Application Pool תחתיו רץ האתר יש הרשאות לגשת ל-Oracle Database , הרשאה זו ניתנת דרך שירות ה-Secure Store.
בדר"כ האפליקציה נוצרת אוטומטית ב-Secure Store אבל אם אינכם ו=רואים את האפליקציה ניתן ליצור אחת כזו :
1.       כנסו לניהול המרכזי של -SP
2.       לחצו על ניהול יישומים ולאחר מכן נהל את יישומי שירות

3.       אנו מעוניינים בשירות הSecure Store  ולכן אנחנו לוחצים עליו
4.       ניצור אחד חדש ... לחצו על חדשים

5.       אנו יוצרים מזהה יישום יעד, שם לתצוגה שיכולה להיות אותו הדבר כמו ה- App ID, וכן הלאה.



6.       בחרו  באפשרות "קבוצה" כסוג יישום יעד שלי.
7.       השאירו את השדות כפי שהם ללא שינוי.


8.       הזינו את שם המשתמש  שמריץ את ה-Application Pool בשני השדות.


9.       לחצו OK וסיימו את התהליך.


לאחר מכן יש לשנות את ההגדרות חיבור שיצרנו ב-SharePoint Designer כך :

1.       עברו לSharePoint Designer  והתחברו לאתר שלכם. בחרו אובייקט אתר סוגי תוכן החיצוני ופתחו את סוג התוכן החיצוני שלכם. לחצו על "מאפייני חיבור ערוך" ב-Ribbon:


2.       במאפייני Endpoint, יש לשנות את מצב האימות להיות אחת מהאפשרויות. בחרו את הרמה-אישית המתאימה ליישום שלכם. הגדיר
ו את ה-Secure Store להיות זיהוי של היישומים שיצרנו לעיל.




3.       במאפייני מידע, שנו את מצב האימות להיות אחת מהאפשרויות. הגדר את החנות המאובטחת יישומי זיהוי להיות זיהוי של היישומים שיצרנו לעיל.


4.       לחצו על אישור

חזרו לרשימת SharePoint שלכם שמשויכת לזרימת עבודה. צרו פריט חדש והפעילו את זרימת העבודה באופן ידני. כאשר פעולת יצירת פריט מבוצעת, כנסו לרשימה החיצונית יוצג פריט חדש.

בהצלחה !
רון נס.


========================================================================================================================================================================================================================================







Hello friends,

In my previous articles I've posted about the linkage between Oracle to SharePoint using BCS Service (Article: SharePoint: Connect to Oracle via WCF Using BCS), and then the establishment of External Content Type mapping data to SP (Article: SharePoint: Connecting to WCF Service as External Content Type).

After seeing that everything works perfect and can synchronize data with two-way SP and Oracle I found out the customer wants to create dynamic forms with InfoPath Forms and that the Form Contain complex fields, which is not possible in External List. We were in the final stretch to the project and we started thinking about a creative solution will meet the problem and does not require developing... So... Using SharePoint workflows seems most correct solution to our problem.

We started creating SharePoint list (Custom List) consists of complex fields like People Picker field as Dropdown options and more.

Then we opened the list as a form in InfoPath (clicking on the Customize Control Form in Ribbon) designed the form as we want, save it and publish the form to SP.

Then we created a Workflow using SharePoint Designer:

1.     Open the SharePoint Designer and connect to your site.

2.     Click on "workflows" on the side menu


3.     Create a "List Workflow", select "List Workflow" Ribbon and select from the list workflow will be linked to it.


4.     Name the workflow description, and then click OK.


5.      Click in "Step 1" and press "action" in the Ribbon. Select "Create list item"


6.     Operation of a new workflow created in "Step 1". Click the "this list" and select the external list to create a new item in it.


7.     When the dialog box opens, select the external list. Press the "Add ..." and map the fields from the list the characteristics and variables outside the workflow.


8.     Click OK when you are done. Step 1 in the workflow should look like the image below


9.     You can add more workflow steps and then save and publish it to the list.


Once you have created the workflow is important to ensure that the User Application Pool has permissions to access Oracle Database, authorization is granted through the Secure Store Service.

Usually the application is automatically created in Secure Store but if don't you can create one:

1.     Enter SharePoint Central Admin  
2.     Click Manage Applications and then Manage Service Applications

3.     We are interested in the Secure Store Service so we click on
4.     create a new one ... click New

5.     We create a target application ID, display name can be the same as the App ID, and so on.



6.     Select "Group" My target application type.
7.      Leave the fields as they are the same.

8.     Enter the name of the user running the Application Pool in both fields.

9.      Click OK and finish the process.


Then change the connection settings created in SharePoint Designer as follows:

1.     Go to SharePoint Designer and connect to your website. Select external content types and open the type of your external content. Click on "Edit Connection Properties" in Ribbon

2.     Endpoint properties, change the authentication mode to be an option. Select the appropriate interpersonal level for your application. Set to the Secure Store Application ID created above.

3.     Characteristics of the information, change the authentication mode to be an option. Set the secure store application ID identifying applications to be created above.

4.      Click OK

Back to your SharePoint workflow associated. Create a new item and run the workflow manually. When item creation operation is performed, go to the external list,  a new item is shown there.

Good Luck J
Ron Ness.


Sunday, August 31, 2014

SharePoint : Connectiong to WCF Service as External Content Type

שלום חברים,

היום אספר לכם איך ממשיכים בתהליך הקישוריות בין SharePoint ל- Oracle בעזרת WCF Service.
במאמר הקודם שפרסמתי תיארתי את הצעדים ליצירת WCF Service שיתממשק ל-Oracle, במאמר זה אפרט על הצעדים הנדרשים כדי לחבר את ה-SharePoint ל-WCF Service דרך External Content Type.

כידוע External Content Type זהו סוג תוכן חיצוני שמאפשר שימוש חוזר במידע חיצוני וניהול ב-SP.
אז בואו נתחיל ביצירת External Content Type וחיבורו ל-WCF Service שיצרנו במאמר הקודם.

1.      פתחו את ה-SharePoint Designer (ניתן גם לפתוח את ה-SharePoint Designer  דרך תפריט הפעולות באתר) ופתחו את האתר הרלוונטי.
2.      בחר ב- External Content Type בסרגל הניווט – פעולה זו תפתח את חלון External Content Types



3.      הזן שם ל-External Content Type ואת ה-Office Item Type בשאר כ - Generic List.



4.      לחץ על "Click here to discover external data sources and define operations’ and you will get the " ולאחר מכן לחץ על Add Connection








5.      לאחר הלחיצה על הפקד אתה תראה חלון - External Data Source Type Selection, בחר ב-WCF Service  ולחץ OK.



6.      חלון WCF Connection יופיע, הזן את WCF Service Metadata URL ואת ה-Service Endpoint URL כמו שמוצג בדוגמה מטה : 



7.      ה-WCF  מתווסף ל-SharePoint Designer כמו שמוצג מטה : 



8.      לאחר שהגדרנו את ה-WCF  שיעבוד מול SP  צריך להגדיר את הפעולות שיתבצעו על רשימת SharePoint  חיצונית שנגדיר בהמשך (External List). – פתח את ההיררכיה תחת ה-WCF Service ולחץ קליק ימני על המתודה GetEmployees, יפתח תפריט עם פעולות שה-SP יבצע , בחר ב- New Read List Operation.



9.      ה-Wizard שרלוונטי לפעולת Read List יוצג.
10.  לחץ על Next ותועבר לחלון Input Parameters Configuration , בגלל שאין לנו בתהליך הנוכחי פרמטר קלט נלחץ על Next ונעבור לחלון Return Parameter Configuration, מאחר והפעולה מחזירה לנו את רשימת העובדים אנו צריכים להגדיר מזהה חד-חד-ערכי כמו בתמונה מטה :


11.  לחץ על Finish ותיווצר לנו פעולת של קבלת רשימת העובדים ברשימת SP.



12.  חזור על צעד 8 והפעם בחר במתודה GetEmployeeByID, יפתח תפריט עם פעולות שה-SP יבצע , בחר ב- New Read Item Operation.



13.  ה-Wizard שרלוונטי לפעולת Read Item יוצג.



14.  הפעם ישנו קלט למתודה והוא מס' העובד לכן במסך הראשון של Input Parameters Configuration אנחנו צריכים למפות את המזהה ה-חד-חד-ערכי לערך הקלט כמו בתמונה מטה :



15.  לחץ על Next ונעבור לחלון Return Parameter Configuration, מאחר והפעולה מחזירה לנו את עובד לפי מספר עובד אנו צריכים להגדיר מזהה חד-חד-ערכי כמו בתמונה מטה :



16.  לחץ על Finish ותיווצר לנו פעולת של קבלת עובד על פי ID  ברשימת SP.
17.  חזור על צעד 8 והפעם בחר במתודה InsertEmployee, יפתח תפריט עם פעולות שה-SP יבצע , בחר ב- New Create Operation.
18.  ה-Wizard שרלוונטי לפעולת Create  יוצג.



19.  גם הפעם ישנו קלט למתודה והוא מס' העובד לכן במסך הראשון של Input Parameters Configuration אנחנו צריכים למפות את המזהה ה-חד-חד-ערכי לערך הקלט כמו בתמונה מטה :



20.  לחץ על Next ונעבור לחלון Return Parameter Configuration, מאחר והפעולה לא מחזירה לנו פלט כלשהו אפשר ללחוץ על Finish ולסיים את ה-Wizard.



21.  שמור את כל הפעולות שביצעת ע"י לחיצה על פקד Save.



22.  בשלב זה לאחר שיצרנו את החיבור בין ה-SharePoint  ל- WCF  וקישוריות ל-Oracle כל מה שנותר לנו לעשות זה ליצור רשימת SP  שתנהל את הנתונים. את הרשימה יוצרים ע"י לחיצה על פקד Create List & Form שנמצא ב-Ribbon.



23.  חלון היצירה נפתח ואנו צריכים להזין  את הפרטים הבאים כמו שמוצג מטה :



24.  פתח את האתר אליו שייכת את הרשימה וודא שהרשימה נוצרה.
25.  לחץ על הרשימה, רוב הסיכויים שתראה הודעה שגיאה שאומרת שאין לך גישה לשרות BCS, כל שעלייך הוא לתת הרשאה לשירות.



26.  כדי לתת גישה לשירות פתח את ה-Central Admin ç בחר ב-Application Management  ç Service Applications ç Manage Service Applications ç בחר בשירות BCS שקיים בחווה .
27.  בחר ב-External Content Type שיצרת ולאחר מכן על פקד Set Object Permissions.



28.  הענק את ההרשאה למשתמשים הרלוונטיים כמו בצילום מסך מטה :



29.  גלוש לרשימה וודא שאתה רואה נתונים (כמובן שצריכים להיות נתונים גם בטבלה ב-Oracle)
30.  נסה להוסיף פריט לרשימה וודא שהוא מתווסף גם ב-Oracle.


לאחר שסיימנו את העבודה התברר שללקוח יש טפסים מורכבים ואין אפשרות לערוך את השדות ברשימה מסוג External List. נדרש מאתנו לתת פתרון גנרי ליצרית טפסים מורכבים שאת הנתונים שמשתמש הקצה ממלא בהם נדחוף לתוך Oracle. במאמר הבא אציג את הפתרון שיצרנו כדי להתגבר על משוכה זו.

בהצלחה,
רון נס.


============================================================================================================================================================================================================================================================

Hello friends,

Today I will tell you how to continue the process of SharePoint connectivity to Oracle using WCF Service.

First Post article described the steps to create WCF Service Connect to Oracle, this article will detail the steps required to connect the WCF Service for SharePoint External Content Type through.

External Content Type as we know allows reuse of external information management in SP.

So let's start creating the External Content Type and connecting to WCF Service created in the previous article.

1.      Open the SharePoint Designer (You can also open the SharePoint Designer Site Actions menu) and open the relevant site.
2.     Select External Content Type navigation bar - This will open a window External Content Types



3.     Enter a name for External Content Type and keep the Office Item Type as - Generic List.

4.     Click on the "Click here to discover external data sources and define operations' and you will get the" and then click on the "Add Connection"







5.      After you click the control you will see a window - External Data Source Type Selection, select WCF Service, and then click OK.


6.     WCF Connection window appears, enter the WCF Service Metadata URL and the Service Endpoint URL as shown in the example below : 




7.     The WCF is added to SharePoint Designer as shown below.



8.      After we defined the WCF work with a SP We should define the actions that are performed on an external SharePoint list(External List). - Open the hierarchy under the WCF Service and right-click on the method "GetEmployees", This Action will open a menu with actions that the SP will, choose "New Read List" Operation.




9.      Read List operation is shown.



10.   Click Next and you will be taken "Input Parameters Configuration" window, because we have no current process input parameter clicked Next and move on "Return Parameter Configuration" window, as the action returns us to the list of employees we need to define a single identifier unequivocal as in the picture below:



11.  Click Finish and the operation will be created for us to obtain a list of employees on the list of SP.
12.  Repeat step 8 and this time select the method "GetEmployeeByID", This Action will open a menu with actions that the SP will perform, select New "Read Item Operation".



13.  Read Item operation is shown.



14.   This time there is an input method and no employee so the first screen of the "Input Parameters Configuration" We need to map the ID-to-one-one-value input value as the picture below:



15.  Click Next and move Return Parameter Configuration window, as the action returns us to the works by a number of works we need to define a single identifier unequivocal as in the picture below:



16.  Click Finish and action will be created of making us work according to the list of SP ID.



17.   Repeat step 8 and this time select the method "InsertEmployee", will open a menu with actions that the SP will perform, select "Create New Operation".



18.  Create Wizard is displayed.



19.  Once again, there is an input method and no employee so the first screen of the Input Parameters Configuration We need to map the ID-to-one-one-value input value as the picture below:



20.  Click Next and move Return Parameter Configuration window, because the operation does not return any output we can click Finish and complete the Wizard.



21.   Save all your use by clicking the Save control.



22.  At this point, having made the connection between the WCF and SharePoint connectivity to Oracle all we have to do is create a list of SP will manage the data. The list form by clicking on the Create Control List & Form found in the Ribbon



23.  creative window opened and we need to enter the following information as shown below:



24.  Open the site belongs to the list and make sure that the list was created.
25.  Click on the list, chances are you will see an error message that says you do not have access to the BCS service, all you have to is to authorize the service.



26.  to give access to the service opened the Central Admin  select Application Management  Service Applications  Manage Service Applications  select BCS exists in the farm.
27.  Select External Content Type you created, and then click Set Object Permissions control.



28.  Grant permission to the relevant users like screenshot below:



29.  Browse to the list and make sure you see the data (data that should be also the table in Oracle)
30.  Try to add an item to the list and make sure it is added in Oracle.


After we finished the job We turned out that customers typically have complex forms, and you can not edit the fields in the list from type External List. We give a generic solution the problem , You Find it In the next article.

Good luck J
Ron Ness.