Showing posts with label 1. Show all posts
Showing posts with label 1. Show all posts

Monday 14 May 2012

How to escape Restrictions on Sandbox Solutions in SharePoint


No comments:
In addition to my previous tip about How to Disable Sandbox Solutions on your SharePoint site I would like to Share another tip about how to escape Restrictions on Sandbox Solutions in SharePoint.

Override Sandbox Restrictions - There are two major ways that a sandboxed solution can escape the usual restrictions.

1. Using Client-side code - To access the resources that are not available from server-side code in a sandboxed solution you can use the client-side object model available. The benefit of using this object model is that there are no code execution restrictions, no resource access restrictions, and no resource usage restrictions.
2.  Full trust proxy (SPProxyOperation) - The sandboxed solutions architecture also enables a technique by which a sandboxed solution can call custom operations that run in full trust. The technique requires that a farm solution be developed that includes one or more classes that derive from
SPProxyOperation. Each of these defines an operation that will run in full trust and can be called from sandboxed solutions by means of the ExecuteRegisteredProxyOperation method. Specifically, these full trust proxy operations execute in the same proxy process (SPUCWorkerProcessProxy.exe) in which the standard Microsoft.SharePoint.dll assembly runs. The proxy operations can return data to the sandboxed solution.
 
Check the Example here to Create a Full-Trust Proxy Operation.


Thursday 22 March 2012

How to use a webpart property in Ecmascript or Javascript client object model in SharePoint 2010


No comments:
Here is a short tip about how to use a webpart property in your Ecmascript or Javascript client object model in your sandbox or visual webpart.

If you need a tip about how to create a custom editorpart toolpart see my Post Create custom EditorPart for Sandbox webpart - SharePoint 2010. So while working with this in my sandbox webpart i had a requirenment to consume the webpart property from my custom editorpart in Javascript client object model.

So here is how you do it -
If your webpart property is for getting a list name below is how you use it in your ecmascript.

var ListName = '<%=taskList%>';

tada!

Wednesday 14 March 2012

SharePoint 2010 Interview Questions and Answers


No comments:
Q. How do I deploy my custom CSS file in Sharepoint 14 hive?
To simply deploy a CSS file you can use “Sharepoint mapped folder” available in vs 2010.
Quick steps -
Create a empty project
Add new item -> select “SharePoint mapped folder”
Select the folder in 14 hive where you want to add the CSS file into. The folder structure then will be added to your Solution.
Next, add your CSS under the desired folder in your solution and deploy.

Q. How do I display a popup when users visits my SharePoint site for the first time.

In SharePoint 2010 you can use JavaScript  client om to display a popup when the use visits your Sharepoint site.  You have to create a property in user profile which will be set when the user clicks on ok on your popup for the first time. The after, you check this property each time the user logs in and you don’t display the popup for us if the property is set already.

Q. How can I deploy my custom master, layouts and aspx page in Sharepoint 2010 site.

You can add a custom Master page,layouts page, and your aspx pages using the module elements file in your VS 2010 solution.

Q. Where do you add logs for you Sharepoint application like webpart of receiver? What’s the preferred location?

Most of the developers like to write into the ULS logs. In Sharepoint 2010 you can write logs to the ULS logs(loc) using the Diagnostics Service.  For example -

SPDiagnosticsService diagSvc = SPDiagnosticsService.Local;
diagSvc.WriteTrace(0, new SPDiagnosticsCategory(“Add category”, TraceSeverity.Monitorable,EventSeverity.Error),TraceSeverity.Monitorable,”Writing to the ULS log: {0}”,new object[] { “Error in WebPart!”});

Q. I need to create a bunch of list and libraries when a new site is created. How can I do it?

You can use the WebProvisioned event receiver which is Fired after the site has been created and is fully provisioned(asynchronous). You can add the new lists and libraries in this WebProvisioned event receiver.

Ref - http://www.learningsharepoint.com/2012/01/23/sharepoint-2010-developer-faqs/

Thursday 19 January 2012

How to ghost your custom layouts master and aspx pages in sharepoint


No comments:
Here is another quick tip on How to ghost your custom layouts master and aspx pages in sharepoint.
While deploying your files like custom Layout Page, Master Page or custom aspx page you might choose to use the available module element. The module element contains <File> tags which specifies the location\URL of the file being deployed. This tag has some additional options to tell Sharepoint if the resource being added is Ghostable or not.

Ghostable and Ghostableinlibrary - Ghostable is used when you need to save the file on the file system. For example, if you need to deploy a cutsom aspx page or a custom master page you can specify Ghostable like below

<file Url="default.aspx" Type="Ghostable">

Ghostableinlibrary is used when you have to deploy your stuff in library. For example deploying CSS, js files in Styles Library in SharePoint 2010. This gives you ability to check in\check out the files and use versioning as well. You can use it by

<file Url="StyleCSS.css" Type="Ghostableinlibrary">