• Henry Akpala
  • NEWBIE
  • 145 Points
  • Member since 2011
  • Vida Consulting

  • Chatter
    Feed
  • 5
    Best Answers
  • 2
    Likes Received
  • 0
    Likes Given
  • 6
    Questions
  • 57
    Replies
I am using Apex REST to call Amazon S3.  I am trying to get the list of the content of a specific folder in a bucket.  The GET request returns all the content of the bucket but I would like to get just the content of a specific bucket.  I think I need to pass a Delimiter and/or a Prefix but not sure how to do this.  I tried this below but doesn't seem to have any effect.
     
       req.setHeader('Prefix','VHUB/INBOX/') ;       
       req.setHeader('Delimiter','/');                        
 
public AWS_Keys__c awsKeySet;
public String bucketname1 = BUCKETNAME; 
public String key1=KEY;
public String secret1=SECRET;
          
// public void readGetFromVirtualS3(){   
         //this is needed for the PUT operation and the generation of the signature.  I use my local time zone.        
        String formattedDateString1 = Datetime.now().format('EEE, dd MMM yyyy HH:mm:ss z','America/Los_Angeles');   
        
        String method1 = 'GET';
        HttpRequest req = new HttpRequest();
        Http http = new Http();
        String filename1 =''; //'500/' ; 
        //String filename = 'VHUB/INBOX/' ;

        req.setEndpoint('https://'+ bucketname1 +'.s3.amazonaws.com' +'/'+ filename1);   
     /********   req.setHeader('Prefix','VHUB/INBOX/') ;		********/
   /********	req.setHeader('Content-Type', ''); 			
  	 		req.setHeader('Delimiter','/');				********/

        req.setMethod(method1);
        req.setHeader('Date', formattedDateString1);
        req.setHeader('Authorization',createAuthHeader(method1,filename1,formattedDateString1,bucketname1,key1,secret1));
         //Execute web service call
            try {
                HTTPResponse res = http.send(req);
                System.debug('MYDEBUG: ' + ' RESPONSE STRING: ' + res.toString());
                System.debug('MYDEBUG: ' + ' RESPONSE STATUS: '+ res.getStatus());
                System.debug('MYDEBUG: ' + ' STATUS_CODE:'+ res.getStatusCode());
                System.debug('MYDEBUG: ' + ' GET_BODY:'+ res.getBody());
                XmlStreamReader reader = res.getXmlStreamReader();
                System.debug(reader.getLocalName());
                
            } catch(System.CalloutException e) {
                system.debug('MYDEBUG: AWS Service Callout Exception on ' + 'ERROR: ' + e.getMessage());
            }
 //   }

  	 //create authorization header for Amazon S3 REST API
    public string createAuthHeader(String method,String filename,String formattedDateString,String bucket,String key,String secret){
        string auth;
        String stringToSign = method+'\n\n\n'+formattedDateString+'\n/'+bucket +'/'+filename;
        Blob mac = Crypto.generateMac('HMACSHA1', blob.valueof(stringToSign),blob.valueof(secret));
        String sig = EncodingUtil.base64Encode(mac);
        auth = 'AWS' + ' ' + key + ':' + sig;
        return auth;
    }

The code returns all the folders and files in the bucket but I need to pass a parameter to only return the content of one folder.


 

I am urgently looking for an experience developer for a short term project to assist with the development of a salesforce1 mobile app.  Candidate should be strong in javascript, html, apex and visualforce.  The app will be primarily a mobile app based on data in standard or custom objects in salesfoce.  Candidate will work remotely but MUST be able to meet the deadline.

Project duration: 4-6weeks with potential for extension.

Please contact
hakpala@vidaconsultingllc.com
Regards
-Henry Akpala
Hello.

I'm trying to understand what happened with daily email limit on Developer Edition. About a year ago our team worked on the specific feature which generates hundreds of emails and sends them to internal SF users using SingleEmailMessage and its setTargetObjectId method. I remember that everything worked perfectly on Developer Edition, Sandbox and PRD (we even were able to send some thousands of emails without any problems and limits).

As of now, we're working on another feature which should generate and send many emails too. But we found that SF can't send hundreds of emails now on our Developer Edition.

I've tried to analyze the problem, but didn't find the reason:
- there are no any exceptions in logs;
- when I look at a log it says: "EMAIL_QUEUE" (email is queued);
- I even tried to reserve email capacity using the code like this Messaging.reserveSingleEmailCapacity(numberOfEmails);, but didn't get any exceptions (limit is still free).
Everything works correctly, but emails are not sent to SF users.

So, my questions:
1) is there a specific limit for emails on Developer Edition? If it's true, then what is the daily limit?
2) did I miss something in the SF documentation? I considered this description:
If you use SingleEmailMessage to email your organization’s internal users, specifying the user’s ID in setTargetObjectId means the email doesn’t count toward the daily limit. However, specifying internal users’ email addresseses in setToAddresses means the email does count toward the limit.


I'm providing a test code for those who want to check it on his Developer Edition:
//1) generate and send emails
List<Messaging.SingleEmailMessage> messages = new List<Messaging.SingleEmailMessage>();
final Integer NUMBER_OF_EMAILS = 300;
for (Integer index = 0; index < NUMBER_OF_EMAILS; index++)
{
    Messaging.SingleEmailMessage email = new Messaging.SingleEmailMessage();
    email.setTargetObjectId(UserInfo.getUserId());
    email.setSubject('Test : ' + index);
    email.setPlainTextBody('test');
    email.saveAsActivity = false;
    messages.add(email);
}
Messaging.SendEmailResult[] results = Messaging.sendEmail(messages, false);

//2) print the results
for (Messaging.SendEmailResult result : results)
{
    System.debug(result);
}
Hi,

How to Query all the fields in your Salesforce Object using Enterprise WSDL?

I need to retrieve all fields in Account object using Query operation\method in enterprise wsdl.I tired the query "select * from Account",this query with "select *" is not working.it throws error Saying "malformed query and unexpected *" in query.

Please let me know what should be the query to seelct all fields from salesforce account object for enterprise wsdl.

also pl help me in understanding what is the difference between Query and QueryAll method in enterprise wsdl?

Thanks in Advance!!
We have used outbound messaging to a standard server no problem. We are now trying to message from SF using Outbound Messaging ang getting the infamous 

javax.net.ssl.SSLPeerUnverifiedException: peer not authenticated

We are using ssl, 8443 and have a public CA SSL cert for the Websphere side.

We are rally hitting the brick wall on this one....anyone have some RECENT solutions to this...especially with Websphere?

Thanks
Hello,

I have the following code in an Apex Batch Apex Class.

try{
            return Database.getQueryLocator(query);
        }catch(Exception ex){
            return null;
        }

However I cannot seem to catch an exception if an invalid query is provided. I receive the following error
System.UnexpectedException: Start did not return a valid iterable object..

If I try to catch the System.UnexpectedException I still receive an error.

Should a try/catch not work in this scenario?

Thanks in advance for any help.

Our company is just beginning implementation of SFDC, and will need a consultant to come into our Los Angeles office to help with initial setup for a couple of days. We are in the west Los Angeles Area near LAX Airport. (Hawthorne/90250). Initially, we will need help with setup of custom fields, as well as importing customer and Item data. Longer term, we'll need to make sure salesforce1 is setup and operating correctly.  Please contact me James at  jkiehle@fulham.com if interested & available.  Consultant needed ASAP, please reply with qualifications and rates.

We are a startup in the process of deploying Salesforce and need a developer to customize a few things. It will be contract work for now, but as we grow, there may be an opportunity to come on board full time. Please e-mail billy@opentrade.net and let's chat. Need this ASAP.

Please I am trying to figure out how to create a VFP that shows the "Action" (Checkbox) field that is normally visible on a list page.

 

 

Hi,

 

I want to get the WSDL files from salesforce. I have username, password and security token. I can download them by logging into salesforce. But I want to get them by provideing URL, Username, Password, Security token.

Is there a way to do this?

 

Thanks,

Vinay Kumar.

I am getting error : System.LimitException: DML currently not allowed 

 

Class.heatclass.getStore: line 9, column 1

 

my code is:

public String getStore() {
for(integer ac=0;ac<mapstr.size();ac++)
{
try{

auditcount__c e=new auditcount__c(Name='hello',count__c=5);
insert e;
}
catch(System.DMLException ex)
{
ApexPages.addMessages(ex);
}
}
return null;
}

 

Any of you guys are aware of the plans of Salesforce to launch an updated version of Eclipse plugin or the Force.com IDE bundle for version 26.0 - Winter'13?