Sharepoint Taxonomy Control in sandbox solution in sharepoint 2013

Hi,
We have requirement  to bind termsets into taxonomy control  using sandbox solution in sharepoint 2013.
I cannot use webpart,and APP. Below code added in aspx page in module.
i cannot write any code as this sandbox solution.
<%@ Register Tagprefix="TaxonomyField" Namespace="Microsoft.SharePoint.Taxonomy" Assembly="Microsoft.SharePoint.Taxonomy, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c"
%>
 <TaxonomyField:TaxonomyWebTaggingControl ID="TWC" runat="server"  SspId="08d413ac-c81d-4232-b1df-c2da46f9b21a" TermSetId="06c93fa1-8a76-4637-9b87-5e612276c199"  AllowFillIn="true" IsMulti="false"
IsDisplayPickerButton="true"  Language="1033"  IsAddTerms="true" >
    </TaxonomyField:TaxonomyWebTaggingControl>
This is able to render the control, where as termsets are not being  displayed.
Please help on this.
-Navya

I don't think hard coding SSPID and TermsetID is a good practice. Try to get the values through code and using unique names.
<Taxonomy:TaxonomyWebTaggingControl ID="TWC" IsDisplayPickerButton="true"
AllowFillIn="true" runat="server"
ShowTaxonomy(TWC, TaxonomyGroup, TermSetName);
public static void ShowTaxonomy(TaxonomyWebTaggingControl control, string taxonomyGroup, string termsetName)
SPContext context = SPContext.Current;
SPSite site = context.Site;
TaxonomySession tsession = new TaxonomySession(site);
TermStore ttermStore = tsession.TermStores["TermStore"];
Group tgroup = ttermStore.Groups[taxonomyGroup];
TermSet productsTermSet = tgroup.TermSets[termsetName];
control.SspId.Add(ttermStore.Id);
control.TermSetId.Add(productsTermSet.Id);
control.IsAddTerms = false;
control.AllowFillIn = false;
control.IsMulti = true;
control.IsIncludeUnavailable = false;
control.Language = 0;
if(termsetName==Constants.UserKeywordsTermSet)
control.AllowFillIn = true;
control.IsAddTerms = true;
Bala

Similar Messages

  • User Control in Sandboxed Solutions

    Is it possible to create user controls in sand boxed solutions like we do in farm solutions by adding  user control under control templates folder in our code solution??

    Application pages, mobile pages, and user controls (.ascx files) cannot be deployed in a sandboxed solution
    http://msdn.microsoft.com/en-us/library/office/gg615454%28v=office.14%29.aspx
    http://technet.microsoft.com/en-in/library/ee721992%28v=office.14%29.aspx
    You can plan to localize these solutions
    http://msdn.microsoft.com/en-us/library/office/gg615460%28v=office.14%29.aspx

  • Sandbox solution in SP 2013

    Is any big enterprise write any sandbox solution in SharePoint 2013? If any enterprise already developed Sandbox solution in a large scale manner what option they have now to migrate it to SP 2013?
    Is Sandbox is implemented only for on-premise application? Or it is implemented for online also?
    Plz share your exclusive real-time experience.

    I think sandbox solutions are "stuck in the middle" right now. If you need full access to all of SharePoint, you must do a full-trust model. If you want total isolation, the new App Model does a better job of isolation. So sandbox solutions (to me) seem
    like the bridge between the old full-trust model and the new cloud app model. The (few) companies that I have seen using sandbox solutions are using them because they are managing their own on-premise SharePoint farms with mature governance processes to allow
    sandbox solutions to be deployed. If companies embraced this approach for 2010, it is still supported in SharePoint 2013. However, for new development, I would encourage you to take a look at the new Cloud App Model to see if your new development can match
    this model. http://msdn.microsoft.com/en-us/office/dn448480
    Andrew Connell does an excellent job on his blog outlining the characteristics of the three app models and when to consider each one.
    http://www.andrewconnell.com/blog/Understanding-SP2013-Apps-aka-Apps-101

  • How to update a People and group field using a sandbox solution

    Hi,
    I am creating a sandbox solution for office 365 and creating a custom form using visual web part, which will allow users to enter data in a custom list.
    And that list also have a user field. I am able to get SharePoint user field on the form (using javascript) which is searching for the user and get a value (working fine).
    Issue: But I am not able to save the user value. Because to save user value I require web, UserID and login name, to construct SPFieldUserValue object or string in "111;#TestUser" format. Moreover that user should be present in
    SiteUserInfoList. 
    I tried web.EnsureUser() but did not work under sanbox solution.
    Can you please provide any pointer or workaround to the problem? I may be missing something here.
    Thanks,
    Himanshu

    Hi,
    According to your description, my understanding is that you want to update the people and group field in Sandbox solution.
    In the sandbox solution, you can still use the web.EnsureUser() function to get the user information, see the thread below:
    EnsureUser in sandboxed solution
    In additional, there is a demo with your similiar requirement for your reference:
    Using the People Picker Control in Sandbox Solutions / Office 365
    Thanks
    Best Regards,
    Jerry Guo
    TechNet Community Support
    Please remember to mark the replies as answers if they help, and unmark the answers if they provide no help. If you have feedback for TechNet Support, contact
    [email protected]

  • Visual WebPart Sandboxed Solutions SP 2013 on Premise

    Hello!!
    Is it possible use one visual webpart with sandboxed solutions at SP 2013 on Premise?
    I created one but when I insert on page an error occurs.
    This is an error.
    An unknown exception occurred while executing a sandboxed code solution request in the worker process.\r\n|0
    Thanks

    Hi,
    Its not possible to deploy visual web part in Sandbox solution for SP 2013 as well as 2010. see the link below for reasons
    http://www.wictorwilen.se/Post/Visual-Web-Parts-in-SharePoint-2010-cannot-be-Sandboxed.aspx
    If you still need to deploy visual webpart there is a work out on this with few limitations, pls check below.
    https://visualstudiogallery.msdn.microsoft.com/8e602a8c-6714-4549-9e95-f3700344b0d9/
    Please remember to click 'Mark as Answer' on the answer if it helps you

  • Creating Termset and terms in Taxonomy using Sandboxe Solution in Sharepoint 2013

    I created a Sandboxed Solution, Added one Visual web part in that solution with one button control. Added Microsoft.Sharepoint.Taxonomy.dll Reference to the solution. Then in the button click event i wrote the following code:
    SPSite site = SPContext.Current.Site;
                var taxonomySession = new TaxonomySession(site);
                var termStore = taxonomySession.DefaultSiteCollectionTermStore;
                lbl1.Text = termStore.ToString();
                var termStoreGroup = termStore.CreateGroup(txtTermSetGroupVal.Text);
                var termSet = termStoreGroup.CreateTermSet(txtTermSetCatNameVal.Text);
                termSet.CreateTerm("AAA", CultureInfo.CurrentCulture.LCID);
                termSet.CreateTerm("BBB", CultureInfo.CurrentCulture.LCID);
                termStore.CommitAll();
    Then, I deployed this solution in one Publishing site. Added one new page in that site and Inserted this visual webpart in that page. When i click that button, I got the
    following error,
    Web Part Error: Unhandled exception was thrown by the sandboxed code wrapper's Execute method in the partial trust app domain: An unexpected error has occurred. Correlation ID: 49c1759c-5913-70a8-76e3-b2827260601a.[SPUserCodeSolutionExecutionFailedException:
    Unhandled exception was thrown by the sandboxed code wrapper's Execute method in the partial trust app domain: An unexpected error has occurred.]

    Hi,
    The Yammer, OneDrive, Sites , My Sites and so on are buttons in the suite bar, the BROWSE, PAGE, SHARE etc. are the buttons in the ribbon, the two bars are added to the master
    page automatically during the converting process.
    A workaround is that we can hide the ribbon by using such a CSS code:
    Best regards,
    Patrick
    Patrick Liang
    TechNet Community Support

  • How can we increase resource quota of sandbox solution in sharepoint 2013?

    Hi,
    i have created a sandbox solution for sharepoint 2013 but the problem is it shows that your resource usage exceeds your quota.so is there any way we can increase the resource usage quota.
    my application is on sharepoint online 365.
    thanks,
    Gaurav

    Sandbox solutions have been deprecated for SharePoint 2013.  And if you're using this within Office 365, then I'm guessing it means you've navigated directly to the _catalogs/solutions library?  As this resource quota is normally controlled from
    Central Administration, you might be stuck with your curent quota.
    Andy Burns has some interesting observations on Office 365 limitations when it comes to Sandbox solutions
    http://www.novolocus.com/2012/07/17/office-365-technical-observations-from-a-first-project/
    Steven Andrews
    SharePoint Business Analyst: LiveNation Entertainment
    Blog: baron72.wordpress.com
    Twitter: Follow @backpackerd00d
    My Wiki Articles:
    CodePlex Corner Series
    Please remember to mark your question as "answered" if this solves (or helps) your problem.

  • "Save As" dialog of excel for a sandbox solution library of sharepoint gives "Web page no longer exist. Error 410"

    Hi
    I created 2 libraries via a sandbox solution for sharepoint 2010. 
    I uploaded an excel file into the library.
    Now on opening via excel that file and clicking "Save as " dialog - it tries to open that sharepoint library where the file resides.
    But i am getting an error of "Webpage no longer exists".

    No, this approach doesn't solve the problem
    I have the same problem. Created a new SharePoint 2010 List Definition project, Sandbox deployment option. List Definition type: Documents Library.
    When attempting to save into the document library from Microsoft Word 2010 I get "The webpage no longer exists" error in the File Save dialog
    If I change the type of the solution to Farm solution it works as expected.
    IISLOGS:
    2013-12-19 10:12:01 127.0.0.1 PROPFIND / - 80 0#.w|domain\username 127.0.0.1 Microsoft-WebDAV-MiniRedir/6.1.7601 207 0 0 35
    2013-12-19 10:12:01 127.0.0.1 PROPFIND /sites - 80 0#.w|domain\username 127.0.0.1 Microsoft-WebDAV-MiniRedir/6.1.7601 207 0 0 26
    2013-12-19 10:12:01 127.0.0.1 PROPFIND /sites/team1 - 80 0#.w|domain\username 127.0.0.1 Microsoft-WebDAV-MiniRedir/6.1.7601 207 0 0 30
    2013-12-19 10:12:01 127.0.0.1 PROPFIND /sites/team1/Lists - 80 0#.w|domain\username 127.0.0.1 Microsoft-WebDAV-MiniRedir/6.1.7601 207 0 0 32
    2013-12-19 10:12:01 127.0.0.1 POST /_vti_bin/shtml.dll/_vti_rpc - 80 0#.w|domain\username 127.0.0.1 Microsoft-WebDAV-MiniRedir/6.1.7601 200 0 0 10
    2013-12-19 10:12:01 127.0.0.1 HEAD /sites/team1/_vti_bin/owssvr.dll dialogview=FileSave&FileDialogFilterValue=*.*&location=Lists/ListDefinitionProject1-ListInstance1 80 - 127.0.0.1 non-browser;+(Windows+NT+6.1.7601) 401 0 0 6
    2013-12-19 10:12:01 127.0.0.1 HEAD /sites/team1/_vti_bin/owssvr.dll dialogview=FileSave&FileDialogFilterValue=*.*&location=Lists/ListDefinitionProject1-ListInstance1 80 - 127.0.0.1 non-browser;+(Windows+NT+6.1.7601) 401 1 2148074254 2
    2013-12-19 10:12:01 127.0.0.1 HEAD /_vti_bin/owssvr.dll dialogview=FileSave&FileDialogFilterValue=*.*&location=Lists/ListDefinitionProject1-ListInstance1 80 0#.w|domain\username 127.0.0.1 non-browser;+(Windows+NT+6.1.7601) 200 0 0 23
    2013-12-19 10:12:01 127.0.0.1 GET /sites/team1/_vti_bin/owssvr.dll dialogview=FileSave&FileDialogFilterValue=*.docx&location=Lists%2FListDefinitionProject1-ListInstance1 80 - 127.0.0.1 non-browser;+(Windows+NT+6.1.7601) 401 0 0 10
    2013-12-19 10:12:01 127.0.0.1 GET /sites/team1/_vti_bin/owssvr.dll dialogview=FileSave&FileDialogFilterValue=*.docx&location=Lists%2FListDefinitionProject1-ListInstance1 80 - 127.0.0.1 non-browser;+(Windows+NT+6.1.7601) 401 1 2148074254
    2
    2013-12-19 10:12:01 127.0.0.1 GET /_vti_bin/owssvr.dll dialogview=FileSave&FileDialogFilterValue=*.docx&location=Lists%2FListDefinitionProject1-ListInstance1 80 0#.w|domain\username 127.0.0.1 non-browser;+(Windows+NT+6.1.7601) 410 0 0 34
    2013-12-19 10:12:01 127.0.0.1 PROPFIND /sites/team1/Lists/ListDefinitionProject1-ListInstance1 - 80 0#.w|domain\username 127.0.0.1 Microsoft-WebDAV-MiniRedir/6.1.7601 207 0 0 36

  • How can I send an email from Sharepoint Online using sandbox solution?

    How can I send an email from Sharepoint Online using sandbox solution?
    If possible I do not want to use workflow.
    Is It possible to do it without using workflow?

    hello Steven Andrews,
    when any user sends a message using contact us page in SharePoint online.
    1. We are inserting item in Contact Us List . - This is working fine
    for anonymous users also. We have used Office365 anonymous codeplex wsp and it is working fine. Anonymous user is able to insert new record in the Contact Us List.
    2. Once, new record is inserted in Contact Us list, we want to fire email notifying thanks to the user on his email id as well as to our company x person for notification of new inquiry. 
    We tried using Workflow having impersonation step for  anonymous user but it is not working for Anonymous users. Workflow is able to sent the email if someone logged into system but not working for Anonymous user although workflow is getting started
    but not able to send email although used Imperonsation step.
    We are stuck into implementing second step.

  • Deploying simple SharePoint 2013 feature causing error: "Error occurred in deployment step 'Add Solution': An unknown exception occurred while executing a sandboxed code solution request in the worker process."

    When trying to deploy a sandboxed solution containing only a feature with a simple associated event receiver from VS 2013, I'm getting the following error:
    Error occurred in deployment step 'Add Solution': An unknown exception occurred while executing a sandboxed code solution request in the worker process.\r\n|0
    I'm working in Visual Studio 2013, deploying to SharePoint 2013.
    The SharePoint project is very basic. I've only added a feature and an associated event receiver. It works without the event receiver. Then after I simply add the event receiver I get the error.
    I've tried deploying directly from VS 2013 as well as publishing to a .WSP and uploading via web interface. Same error reported using both methods. I'm doing this using an Administrator account that I've confirmed is a site collection administrator.
    Additionally, I've found that if I change Sandboxed Solution to False, deploy it, retract it, then change Sandboxed Solution back to True, then I can successfully deploy it. But this doesn't seem to be a permanent solution as the error will resurface a day
    or two later...

    Hi Steve,
    Are you running your SharePoint 2013 on domain controller? 
    http://www.learningsharepoint.com/2013/08/09/sharepoint-2013-error-an-unknown-exception-occurred-while-executing-a-sandboxed-code-solution-request-in-the-worker-process-rn0/
    http://social.technet.microsoft.com/Forums/sharepoint/en-US/b7408608-c21b-45d9-bc16-e6afff510cd2/installed-sharepoint-2013-foundation-on-window-2010-server-issues-activating-sandbox-solutions?forum=sharepointadmin
    My Blog- http://www.sharepoint-journey.com|
    If a post answers your question, please click Mark As Answer on that post and Vote as Helpful

  • Saving Files from Word 2010 into SharePoint 2010 document library deployed as a sandbox solution gives "Web page no longer exist" Error 410

    Created a new SharePoint 2010 List Definition project, Sandbox deployment option. List Definition type: Documents Library. When attempting to save into the document library from Microsoft Word 2010 I get "The webpage no longer exists" error in
    the File Save dialog
    If I change the type of the solution to Farm solution it works as expected.
    IISLOGS:
    2013-12-19 10:12:01 127.0.0.1 PROPFIND / - 80 0#.w|domain\username 127.0.0.1 Microsoft-WebDAV-MiniRedir/6.1.7601 207 0 0 35
    2013-12-19 10:12:01 127.0.0.1 PROPFIND /sites - 80 0#.w|domain\username 127.0.0.1 Microsoft-WebDAV-MiniRedir/6.1.7601 207 0 0 26
    2013-12-19 10:12:01 127.0.0.1 PROPFIND /sites/team1 - 80 0#.w|domain\username 127.0.0.1 Microsoft-WebDAV-MiniRedir/6.1.7601 207 0 0 30
    2013-12-19 10:12:01 127.0.0.1 PROPFIND /sites/team1/Lists - 80 0#.w|domain\username 127.0.0.1 Microsoft-WebDAV-MiniRedir/6.1.7601 207 0 0 32
    2013-12-19 10:12:01 127.0.0.1 POST /_vti_bin/shtml.dll/_vti_rpc - 80 0#.w|domain\username 127.0.0.1 Microsoft-WebDAV-MiniRedir/6.1.7601 200 0 0 10
    2013-12-19 10:12:01 127.0.0.1 HEAD /sites/team1/_vti_bin/owssvr.dll dialogview=FileSave&FileDialogFilterValue=*.*&location=Lists/ListDefinitionProject1-ListInstance1 80 - 127.0.0.1 non-browser;+(Windows+NT+6.1.7601) 401 0 0 6
    2013-12-19 10:12:01 127.0.0.1 HEAD /sites/team1/_vti_bin/owssvr.dll dialogview=FileSave&FileDialogFilterValue=*.*&location=Lists/ListDefinitionProject1-ListInstance1 80 - 127.0.0.1 non-browser;+(Windows+NT+6.1.7601) 401 1 2148074254 2
    2013-12-19 10:12:01 127.0.0.1 HEAD /_vti_bin/owssvr.dll dialogview=FileSave&FileDialogFilterValue=*.*&location=Lists/ListDefinitionProject1-ListInstance1 80 0#.w|domain\username 127.0.0.1 non-browser;+(Windows+NT+6.1.7601) 200 0 0 23
    2013-12-19 10:12:01 127.0.0.1 GET /sites/team1/_vti_bin/owssvr.dll dialogview=FileSave&FileDialogFilterValue=*.docx&location=Lists%2FListDefinitionProject1-ListInstance1 80 - 127.0.0.1 non-browser;+(Windows+NT+6.1.7601) 401 0 0 10
    2013-12-19 10:12:01 127.0.0.1 GET /sites/team1/_vti_bin/owssvr.dll dialogview=FileSave&FileDialogFilterValue=*.docx&location=Lists%2FListDefinitionProject1-ListInstance1 80 - 127.0.0.1 non-browser;+(Windows+NT+6.1.7601) 401 1 2148074254
    2
    2013-12-19 10:12:01 127.0.0.1 GET /_vti_bin/owssvr.dll dialogview=FileSave&FileDialogFilterValue=*.docx&location=Lists%2FListDefinitionProject1-ListInstance1 80 0#.w|domain\username 127.0.0.1 non-browser;+(Windows+NT+6.1.7601) 410 0 0 34
    2013-12-19 10:12:01 127.0.0.1 PROPFIND /sites/team1/Lists/ListDefinitionProject1-ListInstance1 - 80 0#.w|domain\username 127.0.0.1 Microsoft-WebDAV-MiniRedir/6.1.7601 207 0 0 36

    Hi,
    According to your post, an error occurred when you used the custom Documents Library(List Definition using sandbox solution).
    Please check whether you have removed <ContentTypeRef/> in the <ContentTypes/> tag of Schema.xml file in your project.
    Here is a sample about list definition deployed as a sandbox solution, you can take a look at:
    http://sharepointbuzzer.com/2010/10/21/list-definition-using-sandbox-in-sharepoint-2010/
    Best Regards
    Dennis Guo
    TechNet Community Support

  • Activating Sandbox Solution in SharePoint 2013

    Hi,
    I am having a Single Server (Windows Server 2008 R2 Standard) with Microsoft SharePoint Server 2013 installed on it.
    I have one CRM solution which is sandbox solution and I want to deploy it on site collection. 
    When i am going to SiteSettings > Solutions and upload the solutions and click on Activate button .. nothing is happening and solution is not getting activated. When I tried same with powershell using Install-SPUserSolution, I am getting below error,
    Install-SPUserSolution : Object reference not set to an instance of an object.
    At line:1 char:1
    + Install-SPUserSolution -Identity crmlistcomponent1.wsp -Site
    http://in-mum-appcs ...
    + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    ~~~
        + CategoryInfo          : InvalidData: (Microsoft.Share...allUserSolution:
       SPCmdletInstallUserSolution) [Install-SPUserSolution], NullReferenceExcept
      ion
        + FullyQualifiedErrorId : Microsoft.SharePoint.PowerShell.SPCmdletInstallU
       serSolution
    Also, "Microsoft SharePoint Foundation User Code Service" Service is missing on Services On Server page so that I could
    not start it. However I started "SharePoint User Code Host" service in services.msc
    Please help me out, As I have got stuck in this problem from long back.
    Thanks

    From PowerShell, run:
    Install-SPService
    See if the User Code Service is visible on the Manage Services on Server page.
    Trevor Seward
    Follow or contact me at...
    This post is my own opinion and does not necessarily reflect the opinion or view of Microsoft, its employees, or other MVPs.

  • How can i deploy sandboxed solution .wsp file to sharepoint 2013 online using powershell script?

    Is there any way to deploy the Sandbox solution .wsp file to sharepoint 2013 online publishing site using powershell or CSOM or any other way?

    Hi,
    According to your post, my understanding is that you wanted to deploy sandboxed solution .wsp file to sharepoint 2013 online.
    "Add-SPSolution" command is not available in SharePoint Online management shell. So, we cannot use PowerShell to update and deploy a solution in SharePoint Online environment. Meanwhile, here is index of Windows PowerShell for SharePoint Online
    cmdlets for your reference:
    http://technet.microsoft.com/en-us/library/fp161364.aspx
    You can CSOM to deploy solution using helper class from CodePlex. The activation code is as follows: SandboxSolutions.ActivateSolution(siteCollectionURl, cookies, "solution_name.wsp");
    About the Client Side Object Model (CSOM), it is a development related issue, we have a specific support channel for the SharePoint developers, so I recommend you go to our MSDN forum for further assistance.
    Here is a similar thread for you to take a look at:
    http://community.office365.com/en-us/forums/156/t/197404.aspx
    In addition, if you would like to upload and activate sandbox solution manually, you can refer to:
    http://community.office365.com/en-us/forums/154/p/64010/244496.aspx#244496
    Best Regards,
    Linda Li
    Linda Li
    TechNet Community Support

  • Deactivate Sandbox Solution in Office 365 with no access to SharePoint UI

    I have a sandbox solution custom action deployed to my Office 365 site. The custom action is a simple ScriptLink that points to a script. After I activated the feature, every page in the entire Site Collection comes back as a blank page. Every page. Site
    Settings, Solutions, List Settings, pages, lists, views.. you name it.. it's a blank page.  The entire page contents is:
    <html><head><META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=utf-8"><meta name="Robots" content="NOINDEX " /></head><body></body>
                    <script type="text/javascript">
                     var gearPage = document.getElementById('GearPage');
                     if(null != gearPage)
                         gearPage.parentNode.removeChild(gearPage);
                         document.title = "Error";
                     </script>
                     </html>
    Is there anyway for me to deactivate the Custom Action Sandbox Solution without having access to the SharePoint UI?  There doesn't seem to be a PowerShell cmdlet to deactivate a feature and I'm quickly running out of ideas.
    thanks for the help!
    Mark
    The SharePoint Hillbilly
    Fewer Big Words... More Pretty Pictures...
    http://www.SharePointHillbilly.com

    Hi,
    According to your post, my understanding is that you want to deactivate a Sandbox solution feature in Office 356 without accessing to SharePoint UI.
    We can enable or disable a feature from PowerShell using Client Object Model in SharePoint Online.
    Here is an example for your reference:
    http://geeks.ms/blogs/lmanez/archive/2013/09/29/office-365-enable-disable-feature-from-power-shell-using-csom.aspx
    Best Regards
    Dennis Guo
    TechNet Community Support

  • Visual Webpart Sandboxed Solution Error in SharePoint 2013

    I am trying to insert a visual web part using sand boxed solution on a page.But when i insert a web part on page i get the following error.
    "Web Part Error: Unhandled exception was thrown by the sandboxed code wrapper's Execute method in the partial trust app domain: The type is not registered as safe".
    Please suggest how do i get rid off this error as I've to use sand boxed solutions not farm solution.

    Hi ,
    According to your description, my understanding is that you got an error when you used visual web part solution in SharePoint 2013.
    Whether you have enabled the web part solution in Site Collection Administrator->Site Collection features.
    Whether there were some non-authorized methods called in your code.
    Here are some similar posts for you to take a look at:
    http://blogs.msdn.com/b/vincent_runge/archive/2010/05/12/support-answers-on-sandboxed-solutions-in-sharepoint-2010.aspx
    http://social.msdn.microsoft.com/Forums/sharepoint/en-US/8573ec4c-8fdb-40f5-b730-250174a08efb/sandbox-solutions-with-web-parts-upgrade-error?forum=sharepointdevelopmentprevious
    http://sharepoint.stackexchange.com/questions/59679/sandbox-unhandled-exception-was-thrown-partial-trust-app-domain
    http://scrum.codeplex.com/workitem/11222
    I hope this helps.
    Thanks,
    Wendy
    Wendy Li
    TechNet Community Support

Maybe you are looking for