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.