Some of the Share Point Object Which I Practiced Till Now

SP Workflow Manager  
Contains members that enable you to centrally control the workflow templates and instances across a site collection.  

Use the SPWorkflowManager class to centrally manage and control the running instances of workflows across a site collection.  
Use the SPWorkflowManager object to:  
  • Start, run, or cancel workflows.  
  • Return all the workflows currently running on a specific item.  
  • Perform other workflow administration operations.  
The SPWorkflowManager class has no equivalent in the user interface. Through the Microsoft SharePoint Foundation user interface, users interact with the workflows running on items on an individual basis.   
For Understanding Purpose:   
It is used to  creating the task to the user and controlling all the workflow on that particular item.   
1)By using  this object we can start the work flow, stop the work flow, cancel the workflow  

SP Workflow Association Collection  
Represents the workflow associations on a SharePoint 2010 list.  
  
For Understanding Purpose: This is used to send the data of that particular item details like (item id, task id, list name, parent web, so on)  

SPUtility.ValidateFormDigest  
Validates the form digest control that is used in the current request.   
SPUtility.ValidateFormDigest();  
  
The ValidateFormDigest() method can be used to explicitly check the security validation that is used in an ASPX page. This method searches the .aspx page for the INPUT control that is named __REQUESTDIGEST and verifies that the message digest contained in the control is valid. This method can be used in code that runs on a second .aspx page to which the first .aspx page posts, or on the first page if a second page is not involved. This method assumes that a FormDigest control exists on the .aspx page that is making the post.  
  
For Understanding Purpose:   
it is used to trigger the workflow also having SPSecurity.RunWithElevatedPrivileges(delegate()   
its an forwarding a data from 1 application page to another application as per my knowledge  

'it is validating the form of the fist page to second page i.e(if you are sending date from first page but server accpting the data after getting the reqest from the second page. here in the second page it is validating that  the fist page send the data are not as per my understanding on the date of 1-11-2013 
  
SPSecurity.RunWithElevatedPrivileges(delegate()  
Executes the specified method with Full Control rights even if the user does not otherwise have Full Control.  
For Understanding Purpose:  
executes the block of code with app pool administrator credentials   
  
SPSecurity.RunWithElevatedPrivileges(delegate()   
{  
 // implementation details omitted   
});  

SP Context class  
Represents the context of an HTTP request in Microsoft SharePoint Foundation.  
For Understanding Purpose: it will gives the current request url 

SP Principal class  
Represents a user or group that can be assigned permissions in Microsoft SharePoint Foundation to control security.  
SPWeb.GetList method  
Gets the list that is associated with the specified server-relative URL.  
For Understanding Purpose:  It gets the list if it exists else it doesn't through a exception 

SPUtility.SendEmail Mail Sending  
Send Email in Sharepoint using SPUtility.SendEmail using HTML tags.  
   
SPUtility.SendEmail has 4 overloaded method in Sharepoint for sending email to any email address.  
I will discuss mainly 2 methods which can handle every type of html email body in Sharepoint.  
   
1) SPUtility.SendEmail(SPWeb web, bool fAppendHtmlTagbool fHtmlEncode, string to, string subject,string htmlEmailBody)  
   
Most of the time we may need to write a html email body having different styles for text and fonts.Then we can go for this method without much overhead.We can write our email body using html tags but to display our actual email content without html tags we have to take care of one important thing otherwise we will get the email with html tags embedded.  We will have to pass 'false' for 'fHtmlEncode' and 'true' for 'fAppendHtmlTag' as boolean value.  
Limitations: We cannot send email to one than one person at a time with this method.  
2) SPUtility.SendEmail(SPWeb web, StringDictionary messageHeaders, string messageBody)  
   
This overloaded method has more functionality than the one we discussed above.The second parameter includes all the details about the sender,receiver, subject, cc, bcc, and content-type which we will have to add by making object of StringDictionary class and including System.Collections.Specialized in the beginning.We can send email to any number of people at a time.  
For example:  
   //send mail to the member                 StringDictionary headers = new StringDictionary();                                              headers.Add("to", currCtxt.Web.CurrentUser.Email);                 headers.Add("cc", "xyz@abc.com");                 headers.Add("bcc", "");                 headers.Add("from", "email@add.com");                 headers.Add("subject", "Email Subject");                 headers.Add("content-type", "text/html");  
               string bodyText = "Hello how are you?";  
               SPUtility.SendEmail(currCtxt.Web, headers, bodyText.ToString());  
   
NOTE:  One important thing needs to be taken care of in the 'from' we can't provide email address randomly because that will result in no mail to our inbox.The reason behind this is that SharePoint has its setting for SPUtility.SendEmail() method which by default picks the 'From address' from Central administartion-> Operations-> Outgoing E-Mail Settings. Its better not to experiment with 'From addres' without knowledge.Leaving the above reason there will be no problem in sending email to any email address of any domain.  


AllowUnsafeUpdates  


When a developer updates the content database without requiring a security validation AllowUnsafeUpdates property is set to true.  - One the operation is carrried out, the property is again set to false . 






Comments

Unknown said…
Thanks a lot and let me try this SPUtility.SendEmail(SPWeb web, StringDictionary messageHeaders, string messageBody) for my case

Popular posts from this blog

My Interview Experience

React Checkbox Control SPFx