function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
V AnandV Anand 

Insufficient privillages error for attachments

HI...

 

I have created a website with customer portal enabled. Now I want to download attachments of perticular contacts from site. I got this error   Error: Insufficient Privileges

I am using apex for displaying attachments my code is

 n = [SELECT id,name,contenttype,isprivate FROM Attachment WHERE Isprivate=false and ParentID=:Apexpages.currentpage().getparameters().get('id')];
            
             if(n.size() > 0)
               renderlist = true;
               return n;
            
     }   
      
        public Boolean getRenderlist(){ 
           getNotes();
           return renderlist; 
        }

 

<apex:dataTable value="{!notes}" var="cont" width="60%"  cellpadding="10" cellspacing="5" border="0" style="font-family:arial;font-size:14px"  rendered="{!renderlist}">
             <hr/> 
             <h1 style="font-family:arial;font-size:16px;color:red">Attachments</h1>
             <apex:column headerValue="File Name" value="{!cont.name}"  headerClass="headervalue" />
             <apex:column headerValue="Type" value="{!cont.contenttype}"  headerClass="headervalue"/>
             <apex:column headerValue="Content"> <a href="{!URLFOR($Action.Attachment.Download, cont.Id)}" >View</a> 
             <!--<apex:outputLink value="/servlet/servlet.FileDownload?file={!cont.id}" style="font-family:arial;font-size:14px:font-weight:bold;"> View</apex:outputlink>--></apex:column>  
           </apex:dataTable>

 

 and I set contact : read on profile permissions.

But still I am getting this error anyone please solve my problem.