Good Stuff Happens in 1:1 Meetings: Why you need them and how to do them well
SharePoint & Salesforce: Better Together (SharePoint Saturday Event)
1. Emtec Consulting Services | 20 North Wacker Drive Suite 2050, Chicago IL 60606 | 312.669.9600 | sharepoint@emtecinc.com
BETTER TOGTHER:
SHAREPOINT & SALESFORCE
Salesforce-SharePoint Integration
hosting | implementation| support | integration | migration | development | training | help desk
ShareSUCCESS
TM
2. Emtec Consulting Services | 20 North Wacker Drive Suite 2050, Chicago IL 60606 | 312.669.9600 | sharepoint@emtecinc.com
Sponsor Slides…
Thank you #SPSTC
sponsors!
3. Emtec Consulting Services | 20 North Wacker Drive Suite 2050, Chicago IL 60606 | 312.669.9600 | sharepoint@emtecinc.com
About the Presenter…
Born & raised on south shore of Detroit Lakes, MN (half Canadian)…
BS Aerospace Engineering/Control Systems – U of MN IT (1985) DINKYTOWN !!!…
MS (ABT) Mechanical Engineering/Robotics - U of MN IT(1987)…
MS Applied Computer Science/AI – IIT (1995)…
Professor - University Calculus & Engineering (US Peace Corps) – 3+ yrs…
Engineer - High Energy Physics (ANL) – 5+ years…
Developer – Windows Applications – 10 yrs…
Developer – Web Applications – 20+ yrs…
Architect/Developer/Evangelist - SHAREPOINT – 15+ years…
Speaker/Blogger/Thought-Leader on all things Collaboration – related…
Fisherman/Hunter/Outdoorsman/Inventor – in other words… a MINNESOTAN ;-)
Sees SharePoint as one of the most important technologies in 25
years...PROVIDED we all learn to USE IT THE WAY IT WAS INTENDED.
Mark Vogt
Manager – Collaboration/SharePoint Practice
Mark.Vogt@emtecinc.com
630.781.9978 mobile
4. Emtec Consulting Services | 20 North Wacker Drive Suite 2050, Chicago IL 60606 | 312.669.9600 | sharepoint@emtecinc.com
About the Demo Team
credit to key players…
EMTEC-INDIA
Sachin Ghaisas
Rahul Hingmire
Venkatesh Iyengar
Piyush Shah
Nikhil Shringarpure
EMTEC-USA
Kevin Anderson
Erica Archer
Siva Arunachalam
Swamy Bala
Elizabeth Beujter-
Feldman
Deanna Evers
Vince Hastings
Dinesh Kumar
Paul Olson
Jennifer Sammons
John Szuberla
Mark Vogt
5. Emtec Consulting Services | 20 North Wacker Drive Suite 2050, Chicago IL 60606 | 312.669.9600 | sharepoint@emtecinc.com
About Emtec Consulting
your right-sized provider…
73%
YEARS
47serving clients
500dedicated
associates
19
over
years
BEST
PLACES
TO WORK
TECHNOLOGY
EMPOWERED
BUSINESS
SOLUTIONS
“right size provider”
“client for life”
India
Pune
Bangalore
USA
IL, PA, NJ,
GA, VA,
MN, FL
Canada
Toronto
Ottawa
GLOBAL
DELIVERY
OUR SERVICES
87%
14
prior tier 1
consultancies
avg years
experience
fulltime
employees
OUR PEOPLE
25+
OTHER
PARTNERS
- onshore
- offshore
- nearshore
- blended
managed services
Advisory Applications Cloud Analytics Infrastructure
strategy,
governance,
process
ERP, HCM, CRM,
app. development,
mobile solutions
applications,
infrastructure
enterprise reporting,
predictive analytics,
big data
service management,
enterprise infrastructure,
end user computing
6. Emtec Consulting Services | 20 North Wacker Drive Suite 2050, Chicago IL 60606 | 312.669.9600 | sharepoint@emtecinc.com
Emtec’s Mission & Clients…
“At its core, the Emtec experience is about exceptional service - for our clients, partners and associates. We are
passionate about delivering the best technology-empowered business solutions and having fun while doing it.”
Dinesh Desai, Chairman & CEO
7. Emtec Consulting Services | 20 North Wacker Drive Suite 2050, Chicago IL 60606 | 312.669.9600 | sharepoint@emtecinc.com
Emtec’s Microsoft Practice
some quick facts…
• Microsoft Practice Teams:
• SharePoint
• Application Development
• Dynamics ERP (GP & AX)
• Dynamics CRM
NET Development
Integrations / Web Services (GP to SFDC, GP to
Dynamics CRM, GP to SharePoint, etc.)
Business Intelligence & Analytics
• Gartner/AMR-certified in Financial Services
and Professional Services
• Full Capability to provide Managed
Services long-term support both onshore &
offshore
• Solutions delivered in cloud or on-premises
• Upgrades, Software Selections,
Integrations, Mobile Solutions
280
Emtec Resources
205: Infrastructure
Services
15: Package Application
Services
60 : Application
Development Services
8. Emtec Consulting Services | 20 North Wacker Drive Suite 2050, Chicago IL 60606 | 312.669.9600 | sharepoint@emtecinc.com
Understanding Our Clients
common client objectives by area/role…
OPERATIONS
Automation of Processes
Accurate, Timely Reporting
Supplier/Vendor Management
Maintain Profitability
ENTERPRISE
SUITE
SALES &
MARKETING
Delighting the Customer
Higher Customer Engagement
Increase Cross Sell/Up Sell
Improve Forecasting Accuracy
Increase Revenue & GM
HCM
Talent Acquisition
Talent Management
Employee Enablement &
Engagement
Reporting & Analytics
CFO
FINANCE
Optimize Cash Flow
Maintain Compliance
Accurate & Timely Reporting
Maximize Shareholder Value
Financial Controls
TECHNOLOGY
Create Value from IT to
Business Alignment
Continuous Innovation while
Keeping the Lights on
Delivering on Market Trends-
Cloud, Mobility, etc.
Maximize Shareholder Value
Process Improvements
Organizational Growth
Maintain Competitive Advantage
9. Emtec Consulting Services | 20 North Wacker Drive Suite 2050, Chicago IL 60606 | 312.669.9600 | sharepoint@emtecinc.com
Session Goals
Describe not just the WHAT & HOW, but the WHY…
SharePoint Saturday Conferences are NOT SALES PITCHES…
SharePoint Saturday Conferences are venues for sharing TECHNIQUES…
SharePoint Saturday Conferences are venues for sharing VISIONS…
SESSION GOALS:
• Describe a methodology for identifying genuine opportunities for
innovation…
• Show what came from applying that methodology to organizations
with SharePoint & Salesforce as “anchor” technologies…
• Tour the individual components which comprise some useful
SharePoint-Salesforce integration…
• Discuss next-steps where this can be headed, and how the
methodology can be re-purposed with other technologies.
VISIONS
VISIONS
TECHNIQUES
TECHNIQUES
10. Emtec Consulting Services | 20 North Wacker Drive Suite 2050, Chicago IL 60606 | 312.669.9600 | sharepoint@emtecinc.com
The Big Picture…
HOW to know WHAT to “integrate”?...
It’s about more than simply “CAN we do something?”…
• Clients regularly tell us they’ve “tons of vendors who can do what we tell them”…
• Where clients need help is in understanding what they should be asking !
• Clients need a consulting partner who can provide genuine thought leadership.
Purpose of this Demo: Demonstrate a methodology for innovation !
• Emtec calls this RIGHT-MAPPING™:
• Understanding The Users and The Technologies
• Right-Fitting the strengths of each technology to actual user needs
• Illustrating faults in current technology usage
• Road-Mapping creation of integration points (making it affordable & steerable)
• Tracing solution functionality back to actual business needs
• Tracing business needs back to representative personas
• Tracing personas back to actual business users
11. Emtec Consulting Services | 20 North Wacker Drive Suite 2050, Chicago IL 60606 | 312.669.9600 | sharepoint@emtecinc.com
Right-Mapping™…
How we decide what & why to integrate…
INTERVIEW clients and would-be clients (this is surprisingly easy!)
FOLLOW our Right-Mapping™ Exercise to generate a Functional Gap Set
DEVELOP a set of “point” integration solutions to address the Gap Set
COMBINE the set into an overall solution of genuine, traceable value!
UNDERSTAND
The Users
BEGIN
UNDERSTAND
The Technology
RIGHT-FIT
Technology to
Needs
DEFINE
Gap/Integration
Solutions
PROTOTYPE
Gap/Integration
Solutions
DEPLOY
Gap/Integration
Solutions
TEST
Gap/Integration
Solutions
END
USE
Gap/Integration
Solutions
Personas Technology
Scores
Technology
Scorecards
Right-Fit
Diagram
FEEDBACK
From Users
Processes
User Needs
Functional
GAP Set
Solution 2
Solution 1
Solution 3
Solution 4
RESULT: a teachable process for repeated innovation!
12. Emtec Consulting Services | 20 North Wacker Drive Suite 2050, Chicago IL 60606 | 312.669.9600 | sharepoint@emtecinc.com
Applied Methodology
Right-Mapping applied to SharePoint-Salesforce…
So what do you actually GET when you apply Emtec’s Right-Mapping Exercise to
organization with both SharePoint and Salesforce as “anchor” technologies?
SharePoint Users (aka “SalesForce Haters”):
I want to stay in SharePoint when I’m creating my content...
I don’t want to duplicate my effort by replicating that content in SalesForce…
I need all of my teammates (SharePoint lovers & SalesForce lovers) to be in-the-know…
SalesForce Users (aka “SharePoint Haters”):
I want to stay in SalesForce when I’m working…
I don’t want to learn another (SharePoint) UI/UX when I’m trying to work all day…
I still need to be able to find & access content (e.g. news, docs) stored in SharePoint…
TAKEAWAY: The Elegant Solution is “SharePoint-POWERED SalesForce”…
13. Emtec Consulting Services | 20 North Wacker Drive Suite 2050, Chicago IL 60606 | 312.669.9600 | sharepoint@emtecinc.com
Solution Vision:
a SharePoint-Powered SalesForce UI/UX!…
TAKEAWAY: SharePoint hidden within SalesForce is a GOOD THING…
Salesforce lovers get what THEY need to be productive…
SharePoint Library
Widgets to store content
remotely in SharePoint
Libraries…
SharePoint “QUERY”
Widgets to deliver fixed
queries of SharePoint
Content…
SharePoint SEARCH
Widgets to dynamically
search SharePoint
Content…
SharePoint Content Database:
Site Collections
Websites
Doc Libs
Folders
Documents
SP API
SHAREPOINT
UI/UX
functionality
SF API
14. Emtec Consulting Services | 20 North Wacker Drive Suite 2050, Chicago IL 60606 | 312.669.9600 | sharepoint@emtecinc.com
Solution Vision:
Core Functionality…
Cambria
SP2013OP
Environment
Customers
Library
Cambria CMS Site Collection
(SP Document Center template)
Cambria Customers
Website
Customer A001
Folder
Customer A002
Folder
Customer Z999
Folder
Content
Consumption
SF API
SP API
Content
Creation
Content
Consumption
Content
Creation
…Content Creators use
their best tools to
create & manage
content…
…while Content
Consumers use their best
tools to consume this
content!
By intelligently integrating SharePoint and SalesForce
to leverage the strengths of each…
15. Emtec Consulting Services | 20 North Wacker Drive Suite 2050, Chicago IL 60606 | 312.669.9600 | sharepoint@emtecinc.com
Solution Vision:
SharePoint User Experience…
Content Creators use laptops,
browsers, MS Office and
SharePoint to swiftly create,
approve & publish content…
Cambria
SP2013OP
Environment
Customers
Library
Cambria CMS Site Collection
(SP Document Center template)
Cambria Customers
Website
Customer A001
Folder
Customer A002
Folder
Customer Z999
Folder
SP API
Content
Creation
Content
Creation
CONTENT
CREATION
16. Emtec Consulting Services | 20 North Wacker Drive Suite 2050, Chicago IL 60606 | 312.669.9600 | sharepoint@emtecinc.com
Solution Vision:
SalesForce User Experience…
Content Consumers in the field use iPads
and iPhones to browse to SalesForce,
and easily consume this content even
though it’s coming from SharePoint!...
Content
Consumption
SF API
Content
Consumption
17. Emtec Consulting Services | 20 North Wacker Drive Suite 2050, Chicago IL 60606 | 312.669.9600 | sharepoint@emtecinc.com
Demonstration:
Emtec’s SharePoint-Powered SalesForce…
TAKEAWAY: SharePoint hidden within SalesForce is a GOOD THING…
• SharePoint Library functionality
– Upload to SharePoint from Salesforce
– Attach SharePoint file to Salesforce account/opportunity
• SearchByKeyword SharePoint from inside Salesforce Page
– Search Entry Widget
– Search Results Widget
• SearchByProperty SharePoint from inside Salesforce Page
– Important News from SharePoint Canned Search Widget
18. Emtec Consulting Services | 20 North Wacker Drive Suite 2050, Chicago IL 60606 | 312.669.9600 | sharepoint@emtecinc.com
Demonstration:
The elegance & power of the REST Search API…
A simple SearchSharePointByKeyword example…
19. Emtec Consulting Services | 20 North Wacker Drive Suite 2050, Chicago IL 60606 | 312.669.9600 | sharepoint@emtecinc.com
Demonstration:
The elegance & power of the REST Search API…
A complex SearchSharePointByProperty example…
KEY PARTS OF REST SEARCH API’s “MAGIC SPELLS”…
• querytext parameter can be MORE than a keyword!
• querytext parameter can contain ENTIRE QUERIES including PROPERTY-
centric criteria!
• “:” means “CONTAINS”
• Boolean AND and OR operations WORK!
• “-” means “NOT” (extremely POWERFUL!)
• selectproperties parameter controls what’s returned
RESULT: extremely powerful and efficient searches returning XML or JSON
WOWSERS!...
20. Emtec Consulting Services | 20 North Wacker Drive Suite 2050, Chicago IL 60606 | 312.669.9600 | sharepoint@emtecinc.com
Solution Overview:
An SOA-based approach…
TAKEAWAY: Salesforce Form + SharePoint Function = PRODUCTIVITY
• VisualForce (custom SalesForce) pages DON’T directly consume the .NET-based web service & methods!
• SalesForce “imports” the web service and generates SF “WRAPPER” classes & methods!
• VisualForce pages then uses native “Apex” (SF’s proprietary web app dev language) code to interact with
the SalesForce session AND consume these wrapper classes and their methods to INTEGRATE SharePoint
functionality & content into SALESFORCE web pages.
Wrapper
Service
File is
uploaded
Post file1
2
5
Return pathSave path
Save file
Save File
FILE
….
….6
Access file
3
4
7
Access file
21. Emtec Consulting Services | 20 North Wacker Drive Suite 2050, Chicago IL 60606 | 312.669.9600 | sharepoint@emtecinc.com
Solution Overview:
A peek into an “Apex” page explains a LOT…
You DON’T need to be an Apex programmer to understand Apex code enough to “get” this…
Native SF Apex methods leverage the SF API to get
settings (encrypted/encoded authtoken string) …
… decode and unencrypt the string to yield the credentials….
// #### SNIPPET FROM Apex class file “SharePointAuthenticate” ##### //
…
public static String getTokenFromUser(){
User usr= [select id,name, SP_Token__c from User where id=:UserInfo.getuserId()];
return usr.SP_Token__c;
}
public Static String getSPUserName(){
String authToken = getTokenFromUser();
blob authBlob = EncodingUtil.base64Decode(authToken);
Blob cryptoKey = EncodingUtil.base64Decode(label.Crypto_Key);
Blob decryptedData = Crypto.decryptWithManagedIV('AES256', cryptoKey, authBlob);
// Decode the decrypted data for subsequent use…
String decryptedDataString = decryptedData.toString();
list<String> userName = decryptedData.toString().split(':');
if(userName.size() > 0)
return userName[0];
else
return '';
}
22. Emtec Consulting Services | 20 North Wacker Drive Suite 2050, Chicago IL 60606 | 312.669.9600 | sharepoint@emtecinc.com
Solution Overview:
A peek into an “Apex” page explains a LOT…
WELCOME to Service-Oriented Architecture !
// #### SNIPPET FROM Apex class file “SearchQueryController” ##### //
…
private void makeCallout(String userAuthToken, String dataToSearch){
try{
resultWrapperList = new list<SPSearchResultWrapperClass>();
authToken = SharePointAuthentication.getTokenFromUser();
tempuriOrg.BasicHttpBinding_ISPService wbsrvc= new tempuriOrg.BasicHttpBinding_ISPService();
wbsrvc.timeout_x= 120000;
schemasDatacontractOrg200407EmtecE.GenericResponseOfArrayOfSearchResultVKMb8a_Ph response=
wbsrvc.Search_x(userAuthToken,dataToSearch);
if(response.Success){
schemasDatacontractOrg200407EmtecE.ArrayOfSearchResult arrayOfSearch= response.ResponseData;
if(arrayOfSearch.SearchResult != null){
for(schemasDatacontractOrg200407EmtecE.SearchResult seachObj: arrayOfSearch.SearchResult){
SPSearchResultWrapperClass wrapperObj = new SPSearchResultWrapperClass();
wrapperObj.className = seachObj.Class_x;
wrapperObj.id = ''+seachObj.Id;
wrapperObj.title = seachObj.Title;
wrapperObj.url = seachObj.URL;
wrapperObj.creator = seachObj.Author;
wrapperObj.format = seachObj.Format;
wrapperObj.size = ''+seachObj.Size;
wrapperObj.CREATED = ''+seachObj.CreatedDate;
resultWrapperList.add(wrapperObj);
}
}
}
}
catch(Exception ex){
…
… which are then used with the new SF-managed wrapper classes & their methods…
… to interact with SHAREPOINT…
… which returns
response objects…
… which are then processed by the
SF page’s Apex code to render the
results in the SF page
23. Emtec Consulting Services | 20 North Wacker Drive Suite 2050, Chicago IL 60606 | 312.669.9600 | sharepoint@emtecinc.com
Solution Overview:
Major Components of this Demo…
TAKEAWAY: This POC/Demo was meant to be NON-TRIVIAL (“real-life”)…
SOFTWARE COMPONENTS
• Salesforce Visual Force pages (Apex, SOAP)
• .NET (HttpRequest, ICredentials et al)
• Javascript, jQuery, XML (could use JSON)
• SharePoint CSOM KeywordQuery class
• SharePoint REST-ful Search API
INFRASTRUCTURE COMPONENTS
• Salesforce.com Environment (cloud)
• IIS/.NET SPServices Web Services Server (Pune, India)
• SharePoint Farm (SP2013op - Suwanee GA, USA)
• Demo Laptop (Windows 10, IE, Firefox, Chrome, Safari)
24. Emtec Consulting Services | 20 North Wacker Drive Suite 2050, Chicago IL 60606 | 312.669.9600 | sharepoint@emtecinc.com
Solution Overview:
A simple SharePoint 2013 Enterprise Edition On-Premises Farm…
TAKEAWAY: This SharePoint farm was meant to provide only base functionality…
SHAREPOINT FARM COMPONENTS
• SharePoint 2013 Enterprise Edition | On-Premises
• Vanilla installation – meant to be “recognizable”
• Internal URL: http://SUW-SPDEV01/
• External URL: https://spdemos.emtecinc.com
• Several Site Content Types & Site Columns Defined
– Emtec News Item is Content Type we’ll use in demo
25. Emtec Consulting Services | 20 North Wacker Drive Suite 2050, Chicago IL 60606 | 312.669.9600 | sharepoint@emtecinc.com
Solution Overview:
A generalized “SharePoint Gateway” Web Service…
TAKEAWAY: Create a generalized SPService web service extensible & scalable!
You can solve the individual POINT problem
with a POINT solution, or…
… you can set up for
solving the LARGER
solution, setting the stage
for future growth &
innovation!
SPService
- SPUrl (configurable)
- GetContext()
- DecodeFromAuthTokenString()
- DecryptAuthTokenString()
- EncodeToAuthTokenString()
- ConvertToAuthToken()
- Authenticate()
- CreateFolder()
- UploadFileToSharePoint()
- AttachFile()
- GetAllFiles()
- GetAllFilesAndFolders()
…
- SearchSharePointByKeyword()
- SearchSharePointByProperty()
…
Key APIs
CSOM API
- ICredential, ICredentialCache
- AuthToken
- KeywordQuery
REST Search API
- HttpRequest (Icredential, strQueryURI)
…
26. Emtec Consulting Services | 20 North Wacker Drive Suite 2050, Chicago IL 60606 | 312.669.9600 | sharepoint@emtecinc.com
Solution Overview:
A base SalesForce Instance…with extras!
TAKEAWAY: The SalesForce instance IS customized using force.com-approved techniques…
SOFTWARE COMPONENTS
• Base SalesForce structure (all common components)
AND
• Custom SalesForce Visual Force pages (Apex);
• Custom SalesForce widgets (aka web parts);
• Imported SalesForce Wrapper Classes
(force.com-based instances of SPService classes)
27. Emtec Consulting Services | 20 North Wacker Drive Suite 2050, Chicago IL 60606 | 312.669.9600 | sharepoint@emtecinc.com
Solution Detail:
The “SharePoint Gateway” Web Service CODE…
TAKEAWAY: SharePoint’s APIs enable you to re-create functionality that
CAN be consumed from a SalesForce web page!
namespace Emtec.EmShareMobDocumentServiceLib
{
[ServiceContract]
public interface ISPService
{
[OperationContract]
[WebGet(UriTemplate = "Authenticate/?authtoken={authtoken}")]
GenericResponse<AuthResult> Authenticate(string authtoken);
[OperationContract]
[WebGet(UriTemplate = "Authenticate/?authtoken={authtoken}")]
GenericResponse<AuthResult> Authenticate(string authtoken);
[OperationContract]
[WebGet(UriTemplate = "GetDocumentsByFolderName/?authtoken={authtoken}&foldername={foldername}")]
GenericResponse<List<DocumentData>> GetDocumentsByFolderName(string authtoken, string foldername);
[OperationContract]
[WebGet(UriTemplate = "GetFileContent/?authtoken={authtoken}&documentPath={documentPath}")]
GenericResponse<string> GetFileContent(string authtoken, string documentPath);
[OperationContract]
[WebGet(UriTemplate = “UploadFileToSharePoint/?authtoken={authtoken}&libraryName={libraryName}&folderName={folderName}"
GenericResponse<string> UploadFileToSharePoint(string authtoken, string libraryName, string folderName);
[OperationContract]
[WebGet(UriTemplate = “SearchSharePointByKeyword/?authtoken={authtoken}&strQueryText={strQueryText}")]
GenericResponse<string> SearchSharePointByKeyword(string authtoken, string strQueryText);
//... 20+ other methods common to SharePoint libraries, queries and searches ...
}
}
28. Emtec Consulting Services | 20 North Wacker Drive Suite 2050, Chicago IL 60606 | 312.669.9600 | sharepoint@emtecinc.com
Solution Detail
AUTHENTICATING -How credentials work…
STANDARD SALESFORCE USER PROFILE
contains new fields for conveniently storing &
retrieving encoded & encrypted credentials…
POPULATE this SPToken field
during The User’s first-time
use of any “SharePoint-
Powered” widget (e.g.
Search Sidebar Widget)
29. Emtec Consulting Services | 20 North Wacker Drive Suite 2050, Chicago IL 60606 | 312.669.9600 | sharepoint@emtecinc.com
Solution Detail:
Creating a SharePoint AuthToken from SalesForce data…
public static AuthToken DecodeFromAuthTokenString(this string authtoken)
{
AuthToken token = new AuthToken();
try
{
string basicAuthData = DecryptAuthTokenString(authtoken);
string[] strAuthParts = basicAuthData.Split(':');
if (strAuthParts.Length == 2)
{
if (strAuthParts[0].Split('').Length == 2)
{
token.Domain = strAuthParts[0].Split('')[0];
token.UserName = strAuthParts[0].Split('')[1];
}
else
{
token.UserName = strAuthParts[0];
}
token.Password = strAuthParts[1];
}
}
catch (Exception)
{
token = null;
}
return token;
}
START by passing the
encrypted & encoded
SPTokenString from the
SalesForce Current User
(“Usr”) object… DECRYPT the incoming
authtoken string into a big
parse-able string…
INSTANTIATE an empty AuthToken object…
… and ASSIGN values to the
new AuthToken object from
pieces of the decrypted
authtoken string…
… and RETURN an actual AuthToken object for use in making
authenticated web method calls to SPService !
30. Emtec Consulting Services | 20 North Wacker Drive Suite 2050, Chicago IL 60606 | 312.669.9600 | sharepoint@emtecinc.com
Solution Detail:
…and continues with GetContext(AuthToken)…
…
using Microsoft.SharePoint.Client;
using Microsoft.SharePoint;
…
namespace Emtec.EmShareMobDocumentServiceLib
{
public class SpHelper
{
private ClientContext GetContext(AuthToken token)
{
ClientContext ctx = new ClientContext(Constants.SpUrl);
//Configure the handler that will add the header…
ctx.ExecutingWebRequest += new EventHandler<WebRequestEventArgs>(ctx_MixedAuthRequest);
//Set the Windows credentials...
ctx.AuthenticationMode = ClientAuthenticationMode.Default;
CredentialCache cc = new CredentialCache();
cc.Add(new Uri(Constants.SpUrl), Constants.AuthType, new NetworkCredential(token.UserName, token.Password
ctx.Credentials = cc;
return ctx;
}//end of GetContext
}
}
…
INSTANTIATE an actual
SHAREPOINT ClientContext object…
SET both the Authentication Mode and a (persistant) CredentialCache object
which contains EVERYTHING about the SharePoint Context (session)…
RETURN this SharePoint Context object, and now you have an “authenticated session” into
SharePoint, and can execute ANY CSOM or REST method using this security context !...
TAKEAWAY: Once the webservice code has a ClientContext object, it’s “in” SharePoint…
31. Emtec Consulting Services | 20 North Wacker Drive Suite 2050, Chicago IL 60606 | 312.669.9600 | sharepoint@emtecinc.com
Solution Detail:
A “SharePoint Library” Widget…
TAKEAWAY: Salesforce Users only care if they can access their related documents. Period.
TRUTH: You can’t
actually EMBED a
SharePoint library into a
Salesforce web page (e.g.
IFRAMES), but…
DUCK THEORY: If it looks
like a duck and walks like
a duck and quacks like a
duck and flies like a duck
and swims like a duck…
IT’S A DUCK.
… you CAN provide
CRUD functions to
remotely interact with
SharePoint Libraries !
UPLOAD
DOWNLOAD
DELETE
ATTACH
EDIT
CREATE
32. Emtec Consulting Services | 20 North Wacker Drive Suite 2050, Chicago IL 60606 | 312.669.9600 | sharepoint@emtecinc.com
Solution Detail:
SharePoint Library Widget KEY CODE…
public GenericResponse<List<DocumentData>> GetDocumentsByFolderName(string authtoken, string foldername)
{
SPHelper helper = new SPHelper();
return helper.GetDocumentsByList(authtoken.DecodeFromAuthTokenString(), foldername);
}
public GenericResponse<List<DocumentData>> GetDocumentsByList(AuthToken token, string listName)
{
List<DocumentData> listdata = new List<DocumentData>();
GenericResponse<List<DocumentData>> genericResponse = new GenericResponse<List<DocumentData>>();
using (ClientContext ctx = GetContext(token))
{
try
{
var getlist = ctx.Web.Lists.GetByTitle(listName);
ctx.Load(getlist);
ctx.ExecuteQuery();
CamlQuery camlQuery = new CamlQuery();
camlQuery.ViewXml = @"<View></View>";
ListItemCollection listItems = getlist.GetItems(camlQuery);
ctx.Load(listItems);
ctx.ExecuteQuery();
if (listItems != null)
{
foreach (ListItem item in listItems)
{
PERFORM common SharePoint library operations by re-creating this
SharePoint functionality using CSOM API (classes & methods)…
METHODS executed by the SPService (“gateway” web service) server…
COMMON STEPS ACROSS ALL CODE:
1. RETRIEVE the authtoken string from SalesForce session/user object…
2. PASS the authtoken string as a input parameter…
3. TRANSFORM the authtoken string into an AuthToken object (critical!)…
4. INSTANTIATE a SharePoint “ClientContext” object (critical!)…
5. PASS the AuthToken object on all “SharePoint-y” method calls…
6. PERFORM all SharePoint-y operations …
7. RINSE
8. REPEAT
33. Emtec Consulting Services | 20 North Wacker Drive Suite 2050, Chicago IL 60606 | 312.669.9600 | sharepoint@emtecinc.com
Solution Detail:
A “Recent Intranet (SharePoint) News” Widget…
TAKEAWAY: Salesforce Form + SharePoint Function = PRODUCTIVITY
SharePoint Content Database:
Site Collections
Websites
Doc Libs
Folders
Documents
SP API
SHAREPOINT
UI/UX
functionality
SF API
34. Emtec Consulting Services | 20 North Wacker Drive Suite 2050, Chicago IL 60606 | 312.669.9600 | sharepoint@emtecinc.com
Solution Detail:
SearchSharePointIndex() method KEY CODE…
TAKEAWAY: The SharePoint CSOM KeywordQuery class works, but REST API is BETTER…
public GenericResponse<List<DocumentData>> SearchSharepointSearchIndex(AuthToken token, string seacrhText)
{
List<DocumentData> listdata = new List<DocumentData>();
GenericResponse<List<DocumentData>> genericResponse = new GenericResponse<List<DocumentData>>();
string path = string.Empty ;
string title = string.Empty; ;
using (ClientContext ctx = new ClientContext(Constants.SpUrl))
{
//uses keyword query class to do search
var keywordQuery = new KeywordQuery(ctx);
keywordQuery.QueryText = seacrhText;
//send the query to search engine
var searchExecutor = new SearchExecutor(ctx);
var results = searchExecutor.ExecuteQuery(keywordQuery);
ctx.ExecuteQuery();
foreach (var resultRow in results.Value[0].ResultRows)
{
path = Convert.ToString(resultRow["Path"]);
title = Convert.ToString(resultRow["Title"]);
}
}
return genericResponse;
}
35. Emtec Consulting Services | 20 North Wacker Drive Suite 2050, Chicago IL 60606 | 312.669.9600 | sharepoint@emtecinc.com
Solution Detail:
SearchSharePointIndex() method KEY CODE…
public GenericResponse<List<SearchResults>> QueryAllSharepointContentResponse(AuthToken token, string seacrhUri)
{
GenericResponse<List<SearchResults>> genericResponse = new GenericResponse<List<SearchResults>>();
List<SearchResults> objSearchResults = new List<SearchResults>();
XDocument doc = new XDocument();
// Create a request for the URL...
WebRequest request = WebRequest.Create(seacrhUri);
request.Credentials = new NetworkCredential(token.UserName, token.Password, Constants.Domain);
// Get the response...
WebResponse response = request.GetResponse();
// Get the stream containing content returned by the server...
Stream dataStream = response.GetResponseStream();
// Open the stream using a StreamReader for easy access...
StreamReader reader = new StreamReader(dataStream);
//Read the content...
string responseFromServer = reader.ReadToEnd();
var xdoc = XDocument.Parse(responseFromServer);
XNamespace nSpace = "http://schemas.microsoft.com/ado/2007/08/dataservices";
DocumentData docListData = new DocumentData();
foreach (XElement cells in xdoc.Descendants(nSpace + "Cells"))
{
SearchResults objSearch = new SearchResults();
foreach (XElement element in cells.Descendants(nSpace + "element"))
{
…
}
objSearchResults.Add(objSearch);
}
genericResponse.Success = true;
genericResponse.ErrorMessage = string.Empty;
genericResponse.ResponseData = objSearchResults;
return genericResponse;
}
TAKEAWAY: The SharePoint REST API provides keyword-centric and property-centric criteria!…
36. Emtec Consulting Services | 20 North Wacker Drive Suite 2050, Chicago IL 60606 | 312.669.9600 | sharepoint@emtecinc.com
Solution Detail:
A “SharePoint Search Results” Widget…
CAN: create a
custom SharePoint
Search Page with:
- SharePoint Search
Sidebar Widget; and
- SharePoint Search
Results Page Widget
(next-best thing)
CAN’T: modify the native Salesforce Search Results Page (optimal solution)…
37. Emtec Consulting Services | 20 North Wacker Drive Suite 2050, Chicago IL 60606 | 312.669.9600 | sharepoint@emtecinc.com
Discussion…
38. Emtec Consulting Services | 20 North Wacker Drive Suite 2050, Chicago IL 60606 | 312.669.9600 | sharepoint@emtecinc.com
To Schedule a Live Demo…