SPCalendarView in custom Webpart

Hi!
I created a custom webpart where I use dropdown list and set SPCalendarView datasource with custom filter from the selected DropDown value.
The filter is works good. My problem is, how can I set the "Add new Event" to this SPCalendarView?
Please help!
Thanks,
Mykie

Hi,
try this code
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.SharePoint;
static void Main(string[] args)
using (SPSite site = new SPSite("http://sitename"))
using (SPWeb web = site.OpenWeb(""))
SPList list = web.Lists.TryGetList("Calendar");
if (list != null)
SPListItem item = list.Items.Add();
item["Title"] = "New Event";
item["Description"] = "New Event";
item["Location"] = "room1";
item["Start Time"] = DateTime.Now;
item["End Time"] = DateTime.Now.AddDays(1);
item["Category"] = "Business";
item["fAllDayEvent"] = false;
item.Update();
else
System.Console.WriteLine("error");
Kind Regards,
John Naguib
Senior Consultant
John Naguib Blog
John Naguib Twitter
Please remember to mark this as answered if it helped you

Similar Messages

  • Excel data read from users and upload in to Oracle DB using custom webpart

    Hi Team,
    I need to get the excel date from user using file upload control and read the data from the excel using custom webpart and validate the each rows whether having the values or not and need to upload the data to the oracle database.
    Can you please let me know the best approach to read the data from excel using sharepoint custom webpart.
    Thanks,
    Mylsamy

    Hi,
    According to your post, my understanding is that you want to read excel data from the uploaded file and insert the data into Oracle Database.
    The following way for your reference:
    1.Create a Visual Web Part using Visual Studio.
    2. Add an asp.net upload control into the .ascx file.
    <div>
    <asp:FileUpload ID="fileupload" runat="server" />
    <asp:Button ID="btnUpload" runat="server" onclick="btnUpload_Click" Text="Upload" />
    </div>
    3. Add some logic methods into .ascx.cs file.
    protected void btnUpload_Click(object sender, EventArgs e)
    //read data and insert the data into Oracle database.
    4.We can create a web service for adding data to Oracle database, then consume this web service in the visual web part.
    More information:
    http://msdn.microsoft.com/en-us/library/ff597539(v=office.14).aspx
    http://manish4dotnet.blogspot.in/2013/02/upload-ans-read-excel-file-using-c.html
    http://msmvps.com/blogs/windsor/archive/2011/11/04/walkthrough-creating-a-custom-asp-net-asmx-web-service-in-sharepoint-2010.aspx
    Best Regards
    Dennis Guo
    TechNet Community Support

  • Access denied error on updating list through custom webpart

    hi
    I have created one webpart having multiple view option.
    On selection of items from one view user is clicking on next button to get 2nd view (THis is causing postback) and on selection of 2nd view items user is clicking on next buton for 3rd view.
    On third view he can see the submit button. On click on submit button the selected items are updateing in one list and also updating data in other lists.
    The list in which we are updating data have limited access to all users. But previously user were able to upate the list.
    But after implimenting this multiple view with next button which  postbacks on click user are getting access denied error while updating the list. If i provide contribute access to that list then they able to submit the changes properly. But even after
    that they got the error at first time.
    Any body got this type of issue?
    Is the post back on custom webpart cause access denied error?
    i have written my code like this to updat list,
    protected void btnUpdate_Click(object sender, EventArgs e)
    try
    SPSite site = new SPSite(SPContext.Current.Site.ID);
    SPWeb myWeb = site.OpenWeb(SPContext.Current.Web.ID);
    SPSecurity.RunWithElevatedPrivileges(delegate()
    using (SPSite ElevatedSite = new SPSite(site.ID))
    using (SPWeb ElevatedWeb = ElevatedSite.OpenWeb(myWeb.ID))
    ElevatedSite.AllowUnsafeUpdates = true;
    ElevatedWeb.AllowUnsafeUpdates = true;
    //code to update multiple lists
    catch (Exception ex)
    Please suggest any solution for this.

    Yes I checked with ULS log viewer.
    Its very helpfull as reading that text log file is very difficuelt.
    I found that if user spend more time on that webpart then session veriables on that webpart gets expired and at the time of redirection of user to newly created list using below code currentNewList becomes empty and its redirection to wrong list(_abc) which
    is dummy list and user dont have any access.
    currentNewList = NewListName+ "_abc"
    SPUtility.Redirect(currentNewList.DefaultViewUrl, SPRedirectFlags.Default, HttpContext.Current);
    So I modified the code to reload the session data when user clisk on submit button.

  • Issue in rendering CustomToolpart to select data source for custom webpart..

    I have a custom webpart in which i have added a tool part.This toolpart should allow me to select any list in the sitecollection which would be displayed on the webpage on doing apply in the webpart properties.The dropdown list with all lists is coming fine.The
    grid is diplaying as well.But in the toolpart,not in the webpart. I cant seem to segregate the two.There is also a textbox in the  toolpart in which the entered text comes in the webpart.But the same approach is failing for the gridview.Please suggest
    what to do.
    Also,i am failing at making a separate category for the toolpart by specifying [category("List settings")]..Any suggestion as to what i'm doing wrong in that are welcome too.
    Here is my webpart class and toolpart class.
    using System;
    using System.ComponentModel;
    using System.Web;
    using System.Web.UI;
    using System.Web.UI.WebControls;
    using System.Web.UI.WebControls.WebParts;
    using Microsoft.SharePoint;
    using Microsoft.SharePoint.WebControls;
    using Microsoft.SharePoint.WebPartPages;
    using System.Data;
    using Microsoft.SharePoint.Utilities;
    namespace BB.WorkSpaces.Common.WebParts.CustomList
    [ToolboxItemAttribute(false)]
    public class CustomList : Microsoft.SharePoint.WebPartPages.WebPart
    [Browsable(false),
    Category("List Settings"),
    Description("Text Property")]
    // Visual Studio might automatically update this path when you change the Visual Web Part project item.
    private const string _ascxPath = @"~/_CONTROLTEMPLATES/BB.WorkSpaces.Common.WebParts/CustomList/CustomListUserControl.ascx";
    public string ListName
    get
    return _listName;
    set
    _listName = value;
    string _listName;
    public string ListValue
    get
    return _listValue;
    set
    _listValue = value;
    string _listValue;
    public GridView Gv
    get { return gv; }
    set { gv = value; }
    GridView gv;
    protected override void Render(HtmlTextWriter writer)
    base.Render(writer);
    writer.Write(ListName);
    writer.Write("<br />");
    writer.Write(ListValue);
    writer.Write("<br />");
    writer.Write(Gv);
    public override ToolPart[] GetToolParts()
    ToolPart[] allToolParts = new ToolPart[3];
    WebPartToolPart standardToolParts = new WebPartToolPart();
    CustomPropertyToolPart customToolParts = new CustomPropertyToolPart();
    allToolParts[0] = standardToolParts;
    allToolParts[1] = customToolParts;
    allToolParts[2] = new CustomToolPart();
    return allToolParts;
    public class CustomToolPart : Microsoft.SharePoint.WebPartPages.ToolPart
    DropDownList ddl;
    TextBox tb;
    protected override void CreateChildControls()
    ddl = new DropDownList();
    ddl.ID = "ddl";
    // Simply getting the lists of the current web, and displaying them in the dropdown-list.
    SPListCollection lists = SPContext.Current.Web.Lists;
    foreach (SPList list in lists)
    ddl.Items.Add(list.Title);
    tb = new TextBox();
    tb.ID = "tb";
    Controls.Add(ddl);
    Controls.Add(tb);
    base.CreateChildControls();
    public override void ApplyChanges()
    CustomList wp = (CustomList)this.ParentToolPane.SelectedWebPart;
    wp.ListName = ddl.SelectedValue;
    wp.ListValue = tb.Text;
    SPSite site = SPContext.Current.Site;
    SPWeb web = site.RootWeb;
    SPList list = web.Lists[ddl.SelectedItem.Text];
    //SPListItemCollection slist = list.GetItems();
    GridView GV1 = new GridView();
    DataTable dt = list.Items.GetDataTable();
    GV1.DataSource = dt;
    GV1.DataBind();
    this.Controls.Add(GV1);

    Hi,
    According to your post, my understanding is that you have an issue about the custom web part.
    Per my knowledge, we should customize the EditorPart instead of the
    ToolPart to bind the lists to the dropdown list.
    There is a good article about customizing web part, you can refer to it.
    http://www.concurrency.com/blog/create-a-custom-web-part-for-sharepoint-2010/
    More reference:
    http://www.enjoysharepoint.com/Articles/Details/show-all-list-in-dropdown-list-using-visual-web-part-20676.aspx
    Thanks & Regards,
    Jason
    Jason Guo
    TechNet Community Support

  • Using CreatedModifiedInfo in custom webpart SharePoint 2013

    We've used those lines of code in SharePoint 2010 for a long time and we never had any issues with them. We've created a custom webpart and added the modifiedinfo toolbar to the bottom. Now we've moved our site from SP2010 to a SP2013 while still using SP2010
    UI. So we're still in 2010 mode while this problem occurs.
    internal static void AddToolBarInfo(this ToolBar toolBar, SPControlMode mode)
    info = new CreatedModifiedInfo();
    info.ControlMode = mode;
    toolBar.Buttons.Controls.Add(info);
    The control is added properly but no information are shown inside the toolbar. Somehow not many persons have used this toolbar, so I'm not able to find many informations about it. Since we've never done more than adding the control, I don't know where to
    start looking when the control is not properly filled.
    Regards Andreas MCPD SharePoint 2010. Please remember to mark your question as "answered"/"Vote helpful" if this solves/helps your problem.

    Has anyone used the CreatedModifiedInfo before in his code?
    Regards Andreas MCPD SharePoint 2010. Please remember to mark your question as "answered"/"Vote helpful" if this solves/helps your problem.

  • Adding Custom WebPart in AllUsersWebPart in SharePoint 2013

    Hi 
    I am trying to add the Custom WebPart to Custom PageLayout using 
    AllUsersWebPart.But the webpart is not adding to the page when created. The same code if i am adding to Pages AllUsersWebPart , its coming.Is there any thing need to do with PageLayout AllUsersWebPart property  <![CDATA[              
            <?xml version="1.0" encoding="utf-8"?>
            <webParts>
              <webPart xmlns="http://schemas.microsoft.com/WebPart/v3">
                <metaData>
                  <type name="SolutionX.ProjectY.WebParts.MyWebPart, $SharePoint.Project.AssemblyFullName$" />
                  <importErrorMessage>$Resources:core,ImportErrorMessage;</importErrorMessage>
                </metaData>
                <data>
                  <properties>
                    <property name="Title" type="string">My WebPart</property>
                    <property name="Description" type="string">My WebPart for XYZ</property>
                    <property name="ListName" type="string">ExampleList</property>
                    <property name="RowLimit" type="string">5</property>
                  </properties>
                </data>
              </webPart>
            </webParts>
            ]]>
          </AllUsersWebPart>Thanks SPKids

    Hi,
    I assume you are attempting to add this to a standard page layout and not a HTML Page Layout.
    My suggestion is that you add your webpart to a standard content page in the browser first. Save the content page and check in / publishing a major version. Now open your site in SPD and navigate to the Pages library. Your content page should be listed.
    Right click this content page and "Detach" the page from its page layout. You will receive a warning, ok that.
    Once the content page has been detached from the page layout, open the content page in SPD and view the HTML source. Look for your custom webpart in the source. This is the tags / source that you need to add to your custom page layout. You can reattach this
    content page to its page layout now if you wish.
    Eric Overfield - PixelMill -
    ericoverfield.com -
    @EricOverfield

  • Read contents of Pages library and show in custom webpart

    Hi,
    How to read the contents of "Pages" library (Published pages  and custom created pages only and not reading OOB pages)?
    I have a publishing site, in which I need to read the "Title" and URL" of the pages which are created by users and show in a custom webpart. If a new page is published, that page data should be added to the webpart.
    Is it possible to achieve this? I know of Content Query webpart, but I need to custom create a custom webpart with custom styling. Is it possible to use the logic of content query webpart in a custom visual webpart? How to achieve this programmatically?
    Thanks

    The process in 2013 is essentially the same as it was in 2010.  The only difference is that you don't have to manually add additional fields to the datafields list in the .webpart file.  But the .XSL customization is identical.  That's why
    you won't find many articles on how to do it in 2013.  It was already covered in 2010 and hasn't changed.  Here is one example from 2013.
    http://sp2013.blogspot.com/2012/09/content-query-and-metadata-driven.html
    Paul Stork SharePoint Server MVP
    Principal Architect: Blue Chip Consulting Group
    Blog: http://dontpapanic.com/blog
    Twitter: Follow @pstork
    Please remember to mark your question as "answered" if this solves your problem.

  • Adding welcome Menu Box in custom webpart

    Hi
    i want to add the OOB welcome menu box in a custom webpart.
    Am developing a webpart for adding  in the master page which should have the default welcome note included. In default master page, i checked and it was having <wssuc:welcome> tag. I tried adding this tag in webpart, it is throwing error.
    Please help me to add this in the custom webpart
    Harikrishna Baskaran

    this might help you .
    http://blogs.msdn.com/b/richin/archive/2012/07/04/how-to-display-profile-thumbnail-photo-next-to-welcome-message-in-sharepoint.aspx
    Thanks and Regards
    Er.Pradipta Nayak
    Visit my Blog
    Xchanging

  • Creating Dropdown as custom webpart properties

    Hi,
    I have currently created a custom string (textbox) webpart property.
    I would like to add another webpart property which is of dropdown model (enum). However, I am not able to create and associate a default value.
    I want to create a enum as below:
    public enum _ddlPager { 10, 20, 50,100 }
    And also set the default value as 10.
    I have already checked:
    http://www.ashokraja.me/articles/How-to-create-a-custom-property-and-set-a-default-value-in-a-SharePoint-2013-Visual-WebPart
    http://www.learningsharepoint.com/2013/08/22/create-custom-webpart-properties-for-sharepoint-2013-visual-webpart/
    But I was not able to add the numbers.
    How to create a dropdown for custom webpart property?
    Thanks

    Hi,
    Thanks for the reply.
    I have tried like this, but the code has errors:
    #region Custom web part property
    private propertyPager _ddlpropertyPager ;
    public enum propertyPager
    _1a = 10,
    _2a = 20,
    _3a = 50,
    _4a = 100
    [WebBrowsable(true), Personalizable(PersonalizationScope.Shared)]
    public propertyPager propertyPageNumbers
    get { return _ddlpropertyPager; }
    set { _ddlpropertyPager = value; }
    public override EditorPartCollection CreateEditorParts()
    ArrayList editorArray = new ArrayList();
    CustomProperty edPart = new CustomProperty();
    edPart.ID = this.ID + "_editorPart1";
    editorArray.Add(edPart);
    EditorPartCollection editorParts = new EditorPartCollection(editorArray);
    return editorParts;
    public void SaveChanges()
    this.SetPersonalizationDirty();
    //Create a custom EditorPart to edit the WebPart control.
    private class CustomProperty : EditorPart
    DropDownList _ddlPager;
    public CustomProperty()
    Title = "Custom Properties";
    public override bool ApplyChanges()
    SummaryWP part = this.WebPartToEdit as SummaryWP;
    part.propertyPageNumbers = ddlPage.SelectedValue.ToString();
    part.SaveChanges();
    return true;
    public override void SyncChanges()
    EnsureChildControls();
    SummaryWP part = (SummaryWP)WebPartToEdit;
    _ddlPager.SelectedValue = part.propertyPageNumbers;
    protected override void CreateChildControls()
    Controls.Clear();
    _ddlPager = new DropDownList();
    Controls.Add(_ddlPager);
    protected override void RenderContents(HtmlTextWriter writer)
    writer.Write("Items Per Page :");
    writer.WriteBreak();
    _ddlPager.RenderControl(writer);
    writer.Write("");
    writer.WriteBreak();
    writer.Write("--------------------------");
    private DropDownList ddlPage
    get
    EnsureChildControls();
    return _ddlPager;
    #endregion }}
    Getting error in function "Apply Changes" and "Sync Changes"
    How to fix this?
    Thanks

  • Adding a custom Webpart in Application Page

    Hi , 
    I have an Application page, now i have got a requirement to add another custom webpart in that.
    I tried editing them in Sharepoint designer and adding a zone.. but its not supproting "runat=server" tag.
    Hence i m failing to add a custom webpart.
    Please help in this regard.

    Hi,
    Did you have the correct "register"  on your application page :
    <%@ Register TagPrefix="WpNs0" Namespace="CustomForm.MyWebPartName" Assembly="CustomForm, Version=1.0.0.0, Culture=neutral, PublicKeyToken=8834df117dc574a9"%>
    Have a look at this post :
    https://social.msdn.microsoft.com/Forums/sharepoint/en-US/fa372eec-4945-4297-afb1-c7183b007ff1/how-can-i-add-custom-webpart-to-application-page-or-site-page-in-visual-studio?forum=sharepointdevelopment
    Regards
    Gilles Martinez
    Twitter
    Blog
    Please mark as helpful/answer if this resolved your post

  • Adding a custom webpart to webpart page not a safe control issue

    When I am adding a custom web part to web part page I am getting below error as a popup. Plz help if any body resolved the same issue.
    Unable to add selected web part(s). (Web Part Name): A Web Part or Web Form Control on this Page cannot be displayed or imported.
    The type could not be found or it is not registered as safe
    Regards.
    Avinash.
    Avinash

    Hi,
    Here you go. This should help you.
    ow many times have you guys faced an issue like this ?"The type could not be found or it is not registered as safe." .To resolve this, make sure that you add safe controls around your web part assembly in web.config.
    <SafeControls>
    < SafeControl Assembly=”WebPart, Version=1.0.0.0, Culture=neutral, PublicKeyToken=abcdeddf23232″ Namespace=”Mywebpart.WebPart” TypeName=”*” Safe=”True” />
    < /SafeControls>
    The above ensure that your web part code is secured and wont let any anonymous users to access the web part.
    Happy SharePointing ;-)
    http://www.c-sharpcorner.com/Blogs/15024/
    Please remember to click 'Mark as Answer' on the answer if it helps you

  • Changing the Custom Properties of Custom Webpart in Sharepoint 2013.

    Am working on a requirement , where i need to create a quick poll , for that i am using some Third party webpart,
    http://www.amrein.com/apps/page.asp?Q=5755    , this is the link of that Polling webpart , where the source code is not available.
    Question : where by default we have to open the edit properties of that webpart in UI and then can configure those properties. But am facing a requirement like there should be UI with textboxes ,like in a form view in a page itself , and
    after if we could enter those details, guess there is a button in a name " create a poll" ,
    So in a click event , i could add this third party  webpart to the page and now i need to change the custom properties based on the values we enter in the textboxes , how i can access the custom properties after if i got the instance of the that third
    party webpart in a page using splimitedwebpart manager programmatically....??
    Any One can guess this scenario...?? 

    Hi,
    If you use Third party web part, I suggest you contact the author of this web part to extend some custom requirements.
    From your description, my understanding is that you want to create a quick poll.
    Here are two solutions from codeplex with the source code for your reference. You can refer to the source code and customize your own solution base on your requirement. 
    Opinion Poll SharePoint 2010 Web Part
    https://opinionpoll.codeplex.com/
    SPUserPoll - SharePoint Poll Web Part
    https://spuserpoll.codeplex.com/releases/view/104374
    Best Regards
    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]

  • 404 error while adding custom webpart to the page

    I have my solution working in development environment. I deployed the wsp in prod env. While adding one specific webpart to the page leads to 404 error page.
    Thanks in advance.

    Hi,
    boreal123's reply makes sense.
    I would say that somewhere in your specific method call a web service, but it cannot find. You can check the related code snippet.
    I suggest that you can try to store the url in a webpart property so that it can be modified easily.
    Best Regards
    Guangchao chen
    TechNet Community Support

  • Adding custom webpart throwing Javascript error -The collection has not been initialized.

    Hi,
    I created a Javascript CSOM visual webpart and added to page. In the IE developer tools console, I am getting an error as below:
    "SCRIPT5022: The collection has not been initialized. It has not been requested or the request has not been executed. It may need to be explicitly requested.
    SP.Runtime.js, line 2 character 35853".
    My code is as below:
    <script type="text/javascript" src="../../_layouts/15/MicrosoftAjax.js"></script>
    <script type="text/javascript" src="../../_layouts/15/SP.Runtime.js"></script>
    <script type="text/javascript" src="../_layouts/15/sp.js"></script>
    <script type="text/javascript" src="../_layouts/15/sp.ui.controls.js"></script>
    <script type="text/javascript" src="/_layouts/15/test/Scripts/jquery-1.8.2.js"></script>
    <script type="text/javascript" src="/_layouts/15/test/Scripts/Rotator.js"></script>
    <script type="text/javascript" src="/_layouts/15/test/Scripts/bjqs-1.3.js"></script>
    <link rel="stylesheet" type="text/css" href="/_layouts/15/test/CSS/bjqs.css" />
    <SharePoint:FormDigest ID="FormDigestRotator" runat="server">
    </SharePoint:FormDigest>
    <div id="banner-fade">
    <ul id="carousel" class="bjqs">
    </ul>
    </div>
    // In Rotator.js
    $(document).ready(function () {
    SP.SOD.executeFunc('sp.js', 'SP.ClientContext', loadConfigData);
    function loadConfigData() {
    var clientcontext = new SP.ClientContext.get_current();
    var oweb = clientcontext.get_site().get_rootWeb();
    var olist = oweb.get_lists().getByTitle("LibName");
    var configquery = SP.CamlQuery.createAllItemsQuery();
    Allpictures = olist.getItems(configquery);
    clientcontext.load(Allpictures, 'Include(Title,ImgSubURL)');
    clientcontext.executeQueryAsync(Function.createDelegate(this, this.Configsuccess), Function.createDelegate(this, this.Configfailed));
    How to fix this javascript error? Due to this, the "Check-in" option is not working.
    Update: i believe the error is with "executeQueryAsync". How to fix this?
    Thanks

    Hi,
    I suggest you create a simple demo first, once it works, then add other customization into your project gradually. It will be easier to composite the correct code.
    Please apply the code below in your project for a try:
    <script type="text/javascript" src="http://code.jquery.com/jquery-1.10.2.min.js"></script>
    <script type="text/javascript">
    _spBodyOnLoadFunctionNames.push("callCSOM");
    var clientContext;
    var website;
    var str="";
    // Make sure the SharePoint script file 'sp.js' is loaded before your
    // code runs.
    function callCSOM()
    //alert("call");
    $("#Button1").click(function()
    ExecuteOrDelayUntilScriptLoaded(sharePointReady, "sp.js");
    // Create an instance of the current context.
    function sharePointReady() {
    clientContext = SP.ClientContext.get_current();
    website = clientContext.get_web();
    clientContext.load(website);
    clientContext.executeQueryAsync(onRequestSucceeded, onRequestFailed);
    function onRequestSucceeded() {
    str="website.get_title(): "+website.get_title();
    alert(str);
    function onRequestFailed(sender, args) {
    alert('Error: ' + args.get_message());
    </script>
    <input id="Button1" type="button" value="Run Code"/>
    Thanks
    Patrick Liang
    Forum Support
    Please remember to mark the replies as answers if they help and unmark them if they provide no help. If you have feedback for TechNet Subscriber Support, contact
    [email protected]
    Patrick Liang
    TechNet Community Support

  • Adding Custom Webpart (Sandbox) to a page programmatically using CSOM

    I'm trying to add a webpart(sandboxed) to a page programmatically using CSOM.
    I've created a simple windows forms application and tried the below, it gives me error
    Error: "A first chance exception of type 'Microsoft.SharePoint.Client.ServerException'
    occurred in Microsoft.SharePoint.Client.Runtime.dll"- Server Exception occurred.
    Additional Information: Cannot Import this webpart "
    using (ClientContext context = new ClientContext("URL"))
    Web web = context.Web;
    File file = web.GetFileByServerRelativeUrl("/SitePages/Test.aspx");
    LimitedWebPartManager wpMgr = file.GetLimitedWebPartManager(PersonalizationScope.Shared);
    string webpartxml = "<?xml version=\"1.0\" encoding=\"utf-8\"?>" +
    "<webParts>" +
    "<webPart xmlns='http://schemas.microsoft.com/WebPart/v3'>" +
    "<metaData>" +
    "<type name=\"CustomVisualWebPartProject.VisualWebPart1.VisualWebPart1, CustomVisualWebPartProject, Version=1.0.0.0, Culture=neutral, PublicKeyToken=28942db35e131a1c\" />" +
    "<importErrorMessage>Cannot Import this webpart</importErrorMessage>" +
    "</metaData>"+
    "<data>"+
    "<properties>"+
    "<property name=\"Title\" type=\"string\">CustomVisualWebPartProject - VisualWebPart1</property> "+
    "<property name=\"Description\" type=\"string\">My Visual Web Part</property>" +
    "<property name=\"ChromeType\" type=\"chrometype\">None</property>" +
    "</properties>" +
    "</data>" +
    "</webPart></webParts>";
    WebPartDefinition webPartDef = wpMgr.ImportWebPart(webpartxml);
    wpMgr.AddWebPart(webPartDef.WebPart, "Left", 1);
    context.ExecuteQuery();
    Kindly let me know how to resolve it.
    Thanks,
    Pandiarajan

    Hi,
    I have the same issue with you, I also cannot add visual Webpart (Sandbox) to a page using CSOM,but I can add farm solution web part using CSOM, so I change it to farm solution web part.

Maybe you are looking for

  • How do i get all the content of my iPod on a new itunes.

    My old computer died on me and i bought a new laptop. I downloaded the newest iTunes (10.1.1) on it, so now i have a new iTunes and it's not accepting my iPod. I don't want to synchronise my iPod to the new iTunes for in that case i will loose everyt

  • How do I save photos on the Internet to my ipad?

    All I want to do would be the equivalent of right click save to my pictures on. Facebook and put them onto iPad to edit them using a app. The closest I can get to this seems to be having the link for the picture saved to my desktop, but this isn't wh

  • Wireless works for Toshiba but not IPAD

    The wireless in my house via a linksys 2100L. My Toshiba netbook easily picks up the signal in my bedroom but my IPAD does not. The IPAD picks up the signal in the living room so it is not a configuration issue. Any suggestions?  Thanks

  • My kindle books suddenly won't open in ipad

    I have been using my iPad to read kindle books. Downloaded a new book and now none of my kindle books will open

  • I plugged someone elses phone into my itunes - now

    i plugged someone elses phone into my itunes - now they have my info - after i tried to reset their phone it is still asking them for my apple id and password to update their stuff....- how do i reset it back to their info to login.....