0

I am following this document Walkthrough: Creating a Web Part for SharePoint by Using a Designer

but I get this error:

The type or namespace name 'MontlyCalendarView' could not be found. Are you missing a using directive or an assembly reference?

here is the code.

using System;
using System.ComponentModel;
using System.Web.UI.WebControls.WebParts;
using Microsoft.SharePoint;
using Microsoft.SharePoint.WebControls;
using System.Web.UI.WebControls;


namespace SearchCalendars.VisualWebPart1
{
    [ToolboxItemAttribute(false)]
    public partial class VisualWebPart1 : WebPart
    {
        // Uncomment the following SecurityPermission attribute only when doing Performance Profiling on a farm solution
        // using the Instrumentation method, and then remove the SecurityPermission attribute when the code is ready
        // for production. Because the SecurityPermission attribute bypasses the security check for callers of
        // your constructor, it's not recommended for production purposes.
        // [System.Security.Permissions.SecurityPermission(System.Security.Permissions.SecurityAction.Assert, UnmanagedCode = true)]
        public VisualWebPart1()
        {
        }

        protected override void OnInit(EventArgs e)
        {
            base.OnInit(e);
            InitializeControl();
        }

        protected void Page_Load(object sender, EventArgs e)
        {
            MonthlyCalendarView mcv = new MonthlyCalendarView();

        }
    }
}

I am using SharePoint 2013 with Visual Studio 2013. What's wrong?

2

1 Answer 1

0

To solve this problem: when you create your Visual Studio project, select "Deploy as a farm solution" instead of "Deploy as a sandboxed solution".

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.