• kapil chauhan 6
  • NEWBIE
  • 0 Points
  • Member since 2017

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 6
    Questions
  • 1
    Replies
My org is hitting "Asynchronous limit" of salesforce which is 2 Lakh , 50 thousand . I need to know how to know which async process is taking how much time ?

I need to optimize the async calling . 
Hello , File related list & attchment  related list is available in all the objects . But in Email message object only attachment related list is available .
My requirement in email Service is that I need to process attchment of incoming email as file .
So now I am able to attach email attchment to case object as a file using "Content Document" Object  and attchment is visible as file related list and attchment related list as well.
  BUt when it comes to attch incoming attchment to Email message , then Its not working .
Email message do not have file related list only attchment related list .
Can you please suggest anything ?? 
 
We have implemented EmaiService for Email - To - case to automatically create cases from incoming emails .
Is there any identifier in email header to identify spam emails .
In email header  "Received-spf" is there but its not suffient for identifying the spam email .
can you suggest any solution!
Hello ,
I am tring to integrate 2 sales force orgs . I created  partner WSDL in one org ,and when I am tring to pasre this file in another org . I am getting an error:
 It says: Unsupported schema type: {http://www.w3.org/2001/XMLSchema}anyType .
I try changing the 'anyType' value with 'String' . Still its not working .. Can You please help!!!
I need to integrate sales force with Sharepoint. I know about 'Line Connect' but we have some additional requirements. We need to provide a link to user to add documents. that link should be available in case object.
 
I am having a sanario in email to case.
when  a auto response mail is send to user after creation of a case ,methioning the case created details .. 
Situation is if user has setup auto response mail saying that "out of office " .. this out of office email will come back to sales force and again a case will be created with subject " out of office " this will again auto response to user..thus this will go into infinite loop.. 
how to tackle this situation ..??????
One senario I can think of is if in user's " out of office " email we can attach case number ...
But I dont know how to do itt.
plz help
How to integrate sharepoint with salesforce??

I have completed code for sharepoint/salesforce integration code below,but I don't know how to implement this step by step i.e within one class or in different class.

I am new in salesforce development,please help me.

How Salesforce Performs Step 1
The main point for cloud based integration is to host a running service on Microsoft’s cloud app platform Azure, and leveraging it to interact with SharePoint. Since the service is hosted on a cloud platform, we usually access it via web-based URL. So our methods from Salesforce side to request authentication token look something like this:
public static String getToken() {
String token;
if(!Test.isRunningTest()) {
token = SharePointAPIUtility.SharePointAPIGet('http://testingalgoworks.azurewebsites.net/Api/Values/GetAuthToken','Test@test.com','TestingPassword');
}
system.debug('token>>> '+token);
if(token != null) {
return EncodingUtil.urlEncode(token.replaceAll('"',''), 'UTF-8');
}
return null;
}
public static String SharePointAPIGet(String endpointUrl,String username, String password) {
try {
HttpRequest httpRequestObject = new HttpRequest();
httpRequestObject.setEndPoint(endpointUrl);
httpRequestObject.setmethod('GET');

Blob headerValue = Blob.valueOf(username + ':' + password);
String authorizationHeader = 'BASIC ' + EncodingUtil.base64Encode(headerValue);
httpRequestObject.setHeader('Authorization', authorizationHeader);
httpRequestObject.setTimeout(120000);

system.debug('httpRequestObject>> '+httpRequestObject);

Http http = new Http();
HttpResponse httpResponse ;

if(!test.isRunningTest())
httpResponse = http.send(httpRequestObject);

if(httpResponse != null && httpResponse.getStatus() == 'OK' && httpResponse.getStatusCode() == 200) {
system.debug('httpResponse.getBody();>>>>'+httpResponse.getBody()+'httpResponse.getBody();>>>>');
return httpResponse.getBody();
}
else if(httpResponse != null) {
return 'SharePoint Server Error: Status '+ httpResponse.getStatus()+' Status Code '+ httpResponse.getStatusCode() +' Body '+httpResponse.getBody();
}
} catch(CalloutException ce) {
throw ce;
} catch(Exception ex) {
throw ex;
}
return null;
}
This code hits the Azure service using the URL and receives the authentication token which the Azure service sends.
We will come to the steps 2,3 and 5 right after the 5th:
How Salesforce Performs Step 5
Once Salesforce has authentication token, it uses that to request files and folders from the adapter. Once again it uses the Azure service URL to hit the service.
Here’s a method to request files and a method to request folders
public static List<String> getAllFolders(SharePoint365APIParser objSharePoint365APIParser){
try {
list<String> objFolders = new list<String>();
if(objSharePoint365APIParser.folders != null && objSharePoint365APIParser.folders.size()>0) //null check
for(SharePoint365APIParser.folders sp:objSharePoint365APIParser.folders) {
objFolders.add(sp.name);
}
return objFolders;
} catch(Exception ex) {
throw ex;
}
return null;
}
public static List<String> getFilesByFolder(String folderName, SharePoint365APIParser objSharePoint365APIParser) {
//if(!test.isRunningTest()) {
try{
if(objSharePoint365APIParser.folders != null && objSharePoint365APIParser.folders.size()>0)
for(SharePoint365APIParser.folders sp:objSharePoint365APIParser.folders) {
if(sp.name.equalsIgnoreCase(folderName)) {
if(sp.files.size() > 0) { 
return sp.files;
} else {
return new list<String>();
}
}
}
} catch(Exception ex) {
throw ex;
}
//}//end running test loop

return null;
}
How Azure Performs Step 2, 3, and 4
Once Salesforce has sent the request for authentication token, here’s how Azure platform service authenticates login.
[HttpPost]
public bool Login(string email, string password) {
//throw new Exception("This is error!!");
bool validateLogin = false;
List<string> MessageList = new List<string>();
//string decryptedPassword = Encryption.Decrypt(encryptedPassword);
if (email == ConfigurationManager.AppSettings["Email"] && password == ConfigurationManager.AppSettings["Password"]) {
string authInfo = email + ":" + password;
authInfo = Convert.ToBase64String(System.Text.Encoding.Default.GetBytes(authInfo));
//authInfo = Encryption.Encrypt(authInfo);
System.Web.HttpContext.Current.Response.AppendHeader( "Authorization", "Basic " + authInfo);
// Insert User Token
MessageList.Add("Login Successful");
validateLogin = true;
}
else {
MessageList.Add("Invalid Username Or Password");
}
return validateLogin;
}
How Azure service handles Step 6
Now that Salesforce has authentication token and is logged in on SharePoint, here’s how our Azure service parses the request for file and folder lists.
[AuthorizeWebAPI()]
[HttpGet]
public Folders GetResourceData() {
Folders fld = new Folders();
try {
using (ClientContext clientContext = new ClientContext("https://yourprojectname.SharePoint.com/Resources"))
{
SecureString passWord = new SecureString();
foreach (char c in "TestPassword".ToCharArray()) 
passWord.AppendChar(c);

clientContext.Credentials = new SharePointOnlineCredentials("Test@test.com", passWord);
Web rootweb = clientContext.Web;
var folders = rootweb.GetFolderByServerRelativeUrl("/Resources").Folders;
string pString = @"\Resources\";
clientContext.Load(folders);
clientContext.ExecuteQuery();
fld.folders = new List<Folders>();
fld.name = "Resources";
foreach (Microsoft.SharePoint.Client.Folder myFolder in folders)
{
fld.folders.Add(GetFoldersAndFiles(myFolder, clientContext, pString));
}
}
}
catch (Exception)

fld.name = "Some error happened."; }
return fld;
}
private Folders GetFoldersAndFiles(Microsoft.SharePoint.Client.Folder mainFolder, ClientContext clientContext, string pathString) {
Folders fldr = new Folders();
List<string> fls = new List<string>();
fldr.folders = new List<Folders>();
clientContext.Load(mainFolder, k => k.Files, k => k.Folders);
clientContext.ExecuteQuery();
foreach (var folder in mainFolder.Folders)
{
string folderPath = string.Format(@"{0}{1}\", pathString, folder.Name);
if (folder.Name != "Forms")
fldr.folders.Add(GetFoldersAndFiles(folder, clientContext, folderPath));
}
foreach (var file in mainFolder.Files)
{
fls.Add(file.Name);
}
fldr.files = fls;
if (mainFolder.Name != "Forms")
fldr.name = mainFolder.Name;
return fldr;
}