Custom web part in SharePoint Online for "User segments"

Hi Experts,
I was refferd here from the SharePoine Online community. http://community.office365.com/en-us/f/148/p/278071/851153.aspx 
I was following this article to implement user segment in SharePoint Online http://blogs.msdn.com/b/adaptive_experiences_in_sharepoint_2013/archive/2012/11/14/set-up-user-segmentation-to-drive-adaptive-experiences-in-a-product-catalog-in-sharepoint-2013.aspx 
However, this seems to require a custom web part to be build and deployed in SharePoint Online.
Anyone has made user segment work in SharePoint Online? Anyone has done this custom web part before?
Thank you,
Aswath NS

By default the Site Users web part shows all the users and groups who have been give direct permission to the site.  That would not include anyone who was given permission by being added to a group.  You can modify the web part settings to show
a list of people in the Members group of the site or any other specific group.  But there is no setting to show all the users who have access.
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.

Similar Messages

  • Custom web parts in SharePoint 2013 becomes inactive when the session is idle for long time.

    Hi,
    We have a search center site with custom web parts and custom master pages. When the session is inactive for long time all the custom web parts in the page doesn't work, unless we close the browser and open it. Where as this is not the case with the
    OOB web parts. We are not able to identify the root cause as it works with OOB web parts and not the custom web parts.We were able to find that by increasing the session timeout of the web application we can avoid this issue.We do not want to increase the
    session timeout as the OOB web part works perfectly even when the user session is idle for long time.Is there any other alternative where we can acheive the same for custom web parts when the session is idle for long time?
    Thanks,
    Saranya

    Hi Saranya,
    According to your descirption, my understanding is that when the session is long time idle ,then custom web part will not work.
    I suggest you check if you have enable the session in the Page Level in the web.config. By default SharePoint disable the session state.
    In the web.config, you will see <page enableSessionState> tag. You can modify like below and test if it works.
    <pages enableSessionState=”true” ….. />
    Here is a detailed thread for your reference:
    Use Session State in SharePoint
    Best Regards
    Zhengyu Guo
    TechNet Community Support

  • How to fix javascript error/bug on custom web part of SharePoint 2013

    I have a custom web part with serveral business fields. This web part is installed on DispForm, EditForm an NewForm.
    But, I click on Attach File button and a javascrit error is throw on my browser's status bar.
    Line: 5279
    Character: 5
    Code: 0
    URI: http://mysite:4000/_layouts/15/form.debug.js?rev=vyMg8qjZfJ8La1jn7bQ2cg%3D%3D
    How to solve this problem? I think it is a javascript conflict
    Tarcísio Corte [email protected]

    Hi,
    1. You can create a simple demo web part without your custom code firstly, then insert it into your form pages to see if the similar issue would occur. If it works, then add your
    other code into it one after one. By doing this, it will be easier to find out the root cause of this issue.
    2. What browser do you use? Please try to use IE 10(SharePoint 2013), IE8(SharePoint2010).
    3. You can also debug your code using IE F12 Developer Tools.
    http://blogs.msdn.com/b/kaevans/archive/2011/04/25/debugging-javascript-with-the-ie-developer-tools.aspx
    If the issue still exists, I can suggest you provide more information for further research.
    Thanks,
    Dennis Guo
    TechNet Community 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]
    Dennis Guo
    TechNet Community Support

  • Excel web part in sharepoint online

    Under Business data the excel web part not available in SharePoint online. Is Excel web part available in SharePoint online?
    Ravin Singh D

    Hi Ravin,
    so try following steps:
    1. Site Actions -> Site Settings -> Site Collection Features
    2. Scrolled to SharePoint Server Enterprise Site Collection features and click Activate
    3. Now Site Actions -> Site Settings -> Site Features
    4. Scrolled to SharePoint Server Enterprise Site features and click Activate
    Kind Regards,
    John Naguib
    Technical Consultant/Architect
    MCITP, MCPD, MCTS, MCT, TOGAF 9 Foundation
    Please remember to mark your question as answered if this solves your problem

  • 2013 Custom Web Parts in Page Layouts not showing for users

    Custom Web Parts in Page Layouts not showing for users
    I have created a master page in the root site collection for a subsite I am developing. I created content types and custom page layouts for the pages within the subsite.
    I used the snippet tool in the design manager to create web parts and page field markup which I copied into the custom layout HTML pages in the root site collection. For instance I have an image viewer web part that I place there to serve as a section title.
    The problem is that I can see all these customer layout page parts no problem but my users cannot. This leads me to believe its permissions, I am site owner of both the subsite and root site collection.
    The users that cannot see the web parts are site members of the site and restricted read users on the root site collection (where the layouts are stored).
    What gives I'm finding it hard to understand why a snipet generated web part wouldn't show in all pages created from that layout page.
    Any help would be appreciated, Havent found anything on this issue online. weird.

    It is a permission issue indeed. Fix is simple, make sure you check out the page layout page, then check it back in as published version.
    John Architect

  • SharePoint 2013 RSS Viewer not loading when other Custom web part using Update Panel or Ajax Timer control

    Hi,
    SharePoint 2013 RSS
    Viewer web part failing to complete loading when the page loads.
    This happens when having RSS Viewer and then adding a Custom webpart with an updatepanel and timer control.
    I  had used Ajax update panel and timer control to load the web part asynchronously after the main page is fully loaded.
    The RSS-Viewer web part hangs in loading state while the custom webpart loads just fine.
    The issue occurs when an like button click or Timer Tick event fires after the page
    is loaded.
    Haven't been able to track the issue.
    Couple of workaround I tried to call a server side button click event from the custom web part after the page gets fully loaded using JQuery shown below did not work out either.
     $(document).ready(function () {
                $('#<%= netButton2.ClientID %>').click();
    And 
    document.onreadystatechange = function () {
                if (document.readyState == "complete") {
                    $('#<%= netButton2.ClientID %>').click();
    Please let me know how to resolve this issue.
    Thanks,
    Franklin

    Hi Johan,
    The assignment of this user on the given task might be corrupted. Try to remove the resource from the task, publish the project, assign the resource again and publish again the project. If it is not working, try to unpublish the task (column "publish")
    and publih it again.
    Hope this helps,
    Guillaume Rouyre, MBA, MVP, P-Seller |

  • Best Practices in SharePoint 2010 ( Out of the box feature vs Custom Web Part, development )

    Hi
    How do we differentiate on when to allow custom web parts and when to use out of the box.
    What are the performance issues involved when we deploy a custom web part into the SharePoint server. 
    Why do some companies prefer to allow only out of the box features, and no custom work is done?

    SharePoint is a powerful, flexible server product that can provide a wealth collaboration environment right out of box.
    Best answer for your question is depend upon your requirement. Sometime Out of Box features will solve all the problem with little designing. But sometime your requirement need a Custom Web part / solution.
    With OOTB implementation the big advantage is easy to trouble shoot & fix the issues. You will also found tons of blogs on internet for OOTB features. In custom development, its hard to troubleshoot & identifying whether its SharePoint issue or Custom
    code issue.
    check the below article for more ideas.
    http://social.technet.microsoft.com/Forums/sharepoint/en-US/1e7845ef-61e0-4d01-bb6c-92519e6d7139/sharepoint-2010-outofbox-best-practices?forum=sharepointgeneralprevious
    http://www.cdh.com/media/articles/Pages/SharePoint-out-of-the-box---To-customize-or-not-to-customize.aspx
    Master List of SharePoint 2010 On-Premises Custom Development Best Practices
    http://i.zdnet.com/whitepapers/Quest_WPW_SharepointDev_Custom_US_KS_v3.pdf
    Please remember to mark your question as answered &Vote helpful,if this solves/helps your problem. ****************************************************************************************** Thanks -WS MCITP(SharePoint 2010, 2013) Blog: http://wscheema.com/blog

  • Error:System.Web.HttpUnhandledException in Custom Web part for Sandbox solution

    Please Help...
    I have a sandbox solution for Custom Web part which has a 'Visual Web Part(sandbox)'.
    The solution builds, Packages & deploys successfully.
    But when adding this custom web part on a Sharepoint 'Web Part Page' it throws up the below Error:
    Same code when deployed as a Farm Solution works all well.
    Only difference between the two solutions being Farm solution has  'Visual web part'
    and Sandbox solution has 'Visual web part(sandbox)'
    ERROR:
    ======================================================
    [SPUserCodeSolutionExecutionFailedException: Unhandled exception was thrown by the sandboxed code wrapper's Execute method in the partial trust app domain: An unexpected error has occurred.]
     Server stack trace:
      at Microsoft.SharePoint.UserCode.SPUserCodeApplicationHostAppDomainRef.Execute(Type userCodeWrapperType, SPUserCodeCachedAssemblyGroup userAssemblyGroup, Guid siteCollectionId, Byte[] binaryUserCodeToken, Byte[] proxyOperationToken, SPUserCodeExecutionContext
    executionContext)
      at Microsoft.SharePoint.UserCode.SPUserCodeApplicationHostAppDomainRef.Execute(Type userCodeWrapperType, SPUserCodeCachedAssemblyGroup userAssemblyGroup, Guid siteCollectionId, Byte[] binaryUserCodeToken, Byte[] proxyOperationToken, SPUserCodeExecutionContext
    executionContext)
      at Microsoft.SharePoint.UserCode.SPUserCodeAppDomain.Execute(Type userCodeWrapperType, SPUserCodeCachedAssemblyGroup userAssemblyGroup, Guid siteCollectionId, Byte[] binaryUserCodeToken, Byte[] proxyOperationToken, SPUserCodeExecutionContext executionContext)
      at Microsoft.SharePoint.UserCode.SPUserCodeWorkerProcessProxyForShim.ExecuteInternal(Type userCodeWrapperType, SPUserCodeCachedAssemblyGroup userAssemblyGroup, Guid siteCollectionId, Byte[] binaryUserCodeToken, Byte[] proxyOperationToken, SPUserCodeExecutionContext
    executionContext)
      at Microsoft.SharePoint.UserCode.SPUserCodeWorkerProcessProxy.Execute(Type userCodeWrapperType, SPUserCodeCachedAssemblyGroup userAssemblyGroup, Guid siteCollectionId, Byte[] binaryUserCodeToken, Byte[] proxyOperationToken, SPUserCodeExecutionContext
    executionContext)
      at System.Runtime.Remoting.Messaging.StackBuilderSink._PrivateProcessMessage(IntPtr md, Object[] args, Object server, Int32 methodPtr, Boolean fExecuteInContext, Object[]& outArgs)
      at System.Runtime.Remoting.Messaging.StackBuilderSink.SyncProcessMessage(IMessage msg, Int32 methodPtr, Boolean fExecuteInContext)
     Exception rethrown at [0]:
      at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)
      at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)
      at Microsoft.SharePoint.UserCode.SPUserCodeWorkerProcess.ExecuteDelegate.EndInvoke(IAsyncResult result)
      at Microsoft.SharePoint.UserCode.SPUserCodeWorkerProcess.Execute(Type userCodeWrapperType, SPUserCodeCachedAssemblyGroup userAssemblyGroup, Guid siteCollectionId, SPUserToken userToken, String currentAffinity, SPUserCodeExecutionContext executionContext)
      at Microsoft.SharePoint.UserCode.SPUserCodePoolableProcessConnection.Execute(Type userCodeWrapperType, SPUserCodeCachedAssemblyGroup userAssemblyGroup, Guid siteCollectionId, SPUserToken userToken, String affinity, SPUserCodeExecutionContext executionContext)
      at Microsoft.SharePoint.UserCode.SPUserCodeExecutionHost.Execute(Type userCodeWrapperType, Guid siteCollectionId, SPUserToken userToken, String affinity, SPUserCodeExecutionContext executionContext)
      at System.Runtime.Remoting.Messaging.StackBuilderSink._PrivateProcessMessage(IntPtr md, Object[] args, Object server, Int32 methodPtr, Boolean fExecuteInContext, Object[]& outArgs)
      at System.Runtime.Remoting.Messaging.StackBuilderSink.SyncProcessMessage(IMessage msg, Int32 methodPtr, Boolean fExecuteInContext)
     Exception rethrown at [1]:
      at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)
      at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)
      at Microsoft.SharePoint.Administration.ISPUserCodeExecutionHostProxy.Execute(Type userCodeWrapperType, Guid siteCollectionId, SPUserToken userToken, String affinityBucketName, SPUserCodeExecutionContext executionContext)
      at Microsoft.SharePoint.UserCode.SPUserCodeExecutionManager.Execute(Type userCodeWrapperType, SPSite site, SPUserCodeExecutionContext executionContext)
      at Microsoft.SharePoint.UserCode.SPUserCodeWebPartRemoteExecutionHelper.<>c__DisplayClassa.b__9()
      at Microsoft.SharePoint.Utilities.SecurityContext.RunAsProcess(CodeToRunElevated secureCode)
      at Microsoft.SharePoint.UserCode.SPUserCodeWebPartRemoteExecutionHelper.ExecuteRequestInSandBox(HttpContext context, SPWeb web, SPWebPartManager manager, SPUserCodeWebPart userCodeWebPart)
    [HttpUnhandledException: Exception of type 'System.Web.HttpUnhandledException' was thrown.]
     Server stack trace:
      at System.Web.UI.Page.HandleError(Exception e)
      at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
      at System.Web.UI.Page.ProcessRequest(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
      at System.Web.UI.Page.ProcessRequest()
      at System.Web.UI.Page.ProcessRequest(HttpContext context)
      at Microsoft.SharePoint.UserCode.SPUserCodeWebPartWrapper.ExecuteHttpRequest(SPUserCodeWebPartHttpRequestContext webPartExecutionContext, SPUserCodeWebPartHttpResponse httpRequestResponse)
      at Microsoft.SharePoint.UserCode.SPUserCodeWebPartWrapper.Execute(SPUserCodeExecutionContext executionContext)
      at Microsoft.SharePoint.UserCode.SPUserCodeApplicationHostAppDomainRef.ExecuteWrapper(SPUserCodeWrapper wrapper, SPUserCodeExecutionContext executionContext)
      at System.Runtime.Remoting.Messaging.StackBuilderSink._PrivateProcessMessage(IntPtr md, Object[] args, Object server, Int32 methodPtr, Boolean fExecuteInContext, Object[]& outArgs)
      at System.Runtime.Remoting.Messaging.StackBuilderSink.AsyncProcessMessage(IMessage msg, IMessageSink replySink)
     Exception rethrown at [0]:
      at System.Runtime.Remoting.Proxies.RealProxy.EndInvokeHelper(Message reqMsg, Boolean bProxyCase)
      at System.Runtime.Remoting.Proxies.RemotingProxy.Invoke(Object NotUsed, MessageData& msgData)
      at Microsoft.SharePoint.UserCode.SPUserCodeApplicationHostAppDomainRef.CodeToExecuteWrapper.EndInvoke(IAsyncResult result)
      at Microsoft.SharePoint.UserCode.SPUserCodeApplicationHostAppDomainRef.Execute(Type userCodeWrapperType, SPUserCodeCachedAssemblyGroup userAssemblyGroup, Guid siteCollectionId, Byte[] binaryUserCodeToken, Byte[] proxyOperationToken, SPUserCodeExecutionContext
    executionContext)
    [InvalidOperationException: Using Menu.DynamicHoverStyle requires Page.Header to be non-null (e.g. <head runat="server" />).]
      at System.Web.UI.WebControls.Menu.EnsureRenderSettings()
      at System.Web.UI.WebControls.Menu.OnPreRender(EventArgs e, Boolean registerScript)
      at System.Web.UI.Control.PreRenderRecursiveInternal()
      at System.Web.UI.Control.PreRenderRecursiveInternal()
      at System.Web.UI.Control.PreRenderRecursiveInternal()
      at System.Web.UI.Control.PreRenderRecursiveInternal()
      at System.Web.UI.Control.PreRenderRecursiveInternal()
      at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)

    Hi!!
    Sure, Please find .cs and .ascx script below
    ==========.ascx===========================
    <%@ Assembly Name="$SharePoint.Project.AssemblyFullName$" %>
    <%@ Assembly Name="Microsoft.Web.CommandUI, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
    <%@ Register Tagprefix="SharePoint" Namespace="Microsoft.SharePoint.WebControls" Assembly="Microsoft.SharePoint, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
    <%@ Register Tagprefix="Utilities" Namespace="Microsoft.SharePoint.Utilities" Assembly="Microsoft.SharePoint, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
    <%@ Import Namespace="Microsoft.SharePoint" %>
    <%@ Register Tagprefix="WebPartPages" Namespace="Microsoft.SharePoint.WebPartPages" Assembly="Microsoft.SharePoint, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
    <%@ Control Language="C#" AutoEventWireup="true" CodeBehind="DynamicMenuWP.ascx.cs" Inherits="MenuWebPartProject.DynamicMenuWP.DynamicMenuWP" %>
    <asp:Menu ID="siteStructure" runat="server" Orientation="Horizontal"  StaticPopOutImageTextFormatString="" DynamicHoverStyle-BackColor="#CBE3F0" SkipLinkText=""
                                            StaticSubMenuIndent="10px"
    BackColor="#000000" CssClass="BIMenu" Font-Names="Verdana" Font-Size="1em"  DynamicHorizontalOffset="2" onmenuitemclick="siteStructure_MenuItemClick" Target="_blank">
                                            <StaticSelectedStyle
    BackColor="#507CD1" />
              <StaticMenuItemStyle HorizontalPadding="5px" VerticalPadding="2px" CssClass="BIMenuStaticformenu" />
              <DynamicHoverStyle BackColor="#CBE3F0" />
              <DynamicMenuStyle BackColor="#F2F3F4" BorderColor="#A7B4CE" ForeColor="Black" />
              <DynamicSelectedStyle BackColor="#507CD1" />
              <DynamicMenuItemStyle HorizontalPadding="5px" VerticalPadding="2px" CssClass="BIMenuDynamicForMenu" />
            <StaticHoverStyle BackColor="#284E98" ForeColor="White" />
    </asp:Menu>
    ==========.cs===========================
    using System;
    using System.ComponentModel;
    using System.Web.UI;
    using System.Web.UI.WebControls;
    using System.Web.UI.WebControls.WebParts;
    using Microsoft.SharePoint;
    using Microsoft.SharePoint.WebControls;
    using System.Collections.Generic;
    using System.Linq;
    using System.Web;
    namespace MenuWebPartProject.DynamicMenuWP
        [ToolboxItem(false)]
        public partial class DynamicMenuWP : System.Web.UI.WebControls.WebParts.WebPart
            protected override void OnInit(EventArgs e)
                base.OnInit(e);
                InitializeControl();
            protected void Page_Load(object sender, EventArgs e)
                if (!IsPostBack)
                    ScorecardStructure ss;
                    List<ScorecardStructure> listSS = new List<ScorecardStructure>();
                        using (SPWeb web = SPContext.Current.Web)
                            SPList lists = web.Lists["MenuItems"];
                            if (lists.ItemCount > 0)
                                foreach (SPListItem item in lists.Items)
                                    ss = new ScorecardStructure();
                                    ss.title = Convert.ToString(item["Title"]);
                                    ss.ParentID = Convert.ToInt32(Convert.ToString(item["Parent ID"]));
                                    ss.ParentName = Convert.ToString(item["Parent Name"]);
                                    ss.MenuID = Convert.ToInt32(Convert.ToString(item["Menu ID"]));
                                    ss.menuName = Convert.ToString(item["Menu Name"]);
                                    ss.url = Convert.ToString(item["URL"]);
                                    ss.friendlyName = Convert.ToString(item["Friendly Name"]);
                                    listSS.Add(ss);
                    if (listSS.Count > 0)
                        List<ScorecardStructure> y = listSS.Where(s => s.ParentID == 0).ToList<ScorecardStructure>();
                        foreach (var x in y)
                            MenuItem newMenuItem = new MenuItem(x.menuName.ToString(), x.MenuID.ToString());
                            siteStructure.Items.Add(newMenuItem);
                            AddChildMenuItems(listSS, newMenuItem);
            private void AddChildMenuItems(List<ScorecardStructure> menuData, MenuItem parentMenuItem)
                if (menuData.Count > 0)
                    List<ScorecardStructure> childItems = menuData.Where(s => s.ParentID == Convert.ToInt32(parentMenuItem.Value)).ToList<ScorecardStructure>();
                    foreach (var v in childItems)
                        MenuItem newMenuItem = new MenuItem(v.menuName.ToString(), v.MenuID.ToString());
                        newMenuItem.NavigateUrl = v.url.ToString();
                        parentMenuItem.ChildItems.Add(newMenuItem);
                        // This code is used to recursively add child menu items filtering by ParentID
                        AddChildMenuItems(menuData, newMenuItem);
            protected void siteStructure_MenuItemClick(object sender, MenuEventArgs e)
                string st = e.Item.NavigateUrl;
                if (!(st.Equals(string.Empty)))
                    HttpContext.Current.Response.Redirect(st);
            class ScorecardStructure
                public string title { get; set; }
                public int ParentID { get; set; }
                public string ParentName { get; set; }
                public int MenuID { get; set; }
                public string menuName { get; set; }
                public string url { get; set; }
                public string friendlyName { get; set; }
            public bool IsPostBack { get; set; }

  • Custom Login Web Part In SharePoint 2010 Forms Based

    Hi ,
    Im trying to make Custom Login Web Part In SharePoint 2010 Forms Based , all membership configration is done . 
    my question is why (Login1.username , Login1.password ) give this error : 
     login1 does not exist in the current context
    protected
    void
    Login1_Authenticate(object
    sender, AuthenticateEventArgs e)
    02        {
    03            string
    membership = "MembershipProvider";
    04            string
    role = "RoleProvider";
    05 
    06            e.Authenticated
    = SPClaimsUtility.AuthenticateFormsUser(new
    Uri(SPContext.Current.Web.Url),Login1.UserName,Login1.Password);
    07 
    08            if
    (!e.Authenticated) return;
    09 
    10            SecurityToken
    token = SPSecurityContext.SecurityTokenForFormsAuthentication(new
    Uri(SPContext.Current.Web.Url), membership, role,
    Login1.UserName,
    Login1.Password);

    Error 1 No overload for method 'SecurityTokenForFormsAuthentication' takes 3 arguments
    Error 2 The name Wss doesnot exisit in current context 
    Can anyone give sugeestion please 
    cant recitfy this error 
    protected void Login1_Authenticate(object sender,
    AuthenticateEventArgs e)
    02        {
    03            string membership
    = "MembershipProvider";
    04            string role
    = "RoleProvider";
    05 
    06            e.Authenticated
    = SPClaimsUtility.AuthenticateFormsUser(newUri(SPContext.Current.Web.Url),Login1.UserName,Login1.Password);
    07 
    08            if (!e.Authenticated) return;
    09 
    10            SecurityToken
    token = SPSecurityContext.SecurityTokenForFormsAuthentication(newUri(SPContext.Current.Web.Url),
    membership, role,
    Login1.UserName,
    Login1.Password);

  • How to force my Web part to run regardless of users permissions

    I have created the following custom permission , which will allow users to Create items without being able to view,edit them:-
    $spweb=Get-SPWeb -Identity "http://vstg01";
    $spRoleDefinition = New-Object Microsoft.SharePoint.SPRoleDefinition;
    $spRoleDefinition.Name = "Submit only";
    $spRoleDefinition.Description = "Can submit/add forms/files/items into library or list but cannot view/edit them.";
    $spRoleDefinition.BasePermissions = "AddListItems, ViewPages, ViewFormPages, Open";
    $spweb.RoleDefinitions.Add($spRoleDefinition);
    $spweb.Dispose();
    then inside my "Issue Tracking List" i stop inheriting permission from team site , and i define the following permission for all users:-
    now users can add items and they can not view them ,, which is perfect :).
    But now i wanted to add a custom web part to my Create form which will hide certain fields if the user is not within specific group ,the web part looks as follow:-
    protected override void OnInit(EventArgs e)
    base.OnInit(e);
    InitializeControl();
    using (SPSite site = new SPSite(SPContext.Current.Site.Url))
    using (SPWeb web = site.OpenWeb())
    web.AllowUnsafeUpdates = true;
    SPGroup group = web.Groups["Intranet Visitors"];
    bool isUser = web.IsCurrentUserMemberOfGroup(group.ID);
    if (!isUser)
    SPList myList = web.Lists.TryGetList("Issue List");
    SPField titleField = myList.Fields.GetField("Category");
    titleField.Hidden = true;
    titleField.ShowInEditForm = false;
    titleField.ShowInNewForm = false;
    titleField.ShowInDisplayForm = false;
    titleField.Update();
    myList.Update();
    // web.AllowUnsafeUpdates = false;
    else
    SPList myList = web.Lists.TryGetList("Issue List");
    SPField titleField = myList.Fields.GetField("Title");
    titleField.Hidden = false;
    titleField.Update();
    myList.Update();
    // //web.AllowUnsafeUpdates = false;
    web.AllowUnsafeUpdates = false;
    then i deploy the web part and i add it to the Create form. but after doing so user are not able to create items and they will get the following error:-
    Sorry this site has not been shared with you
    so can anyone advice how to force my web part to run , without checking the users permissions or with minimal permssions ?

    in this case, use the elevated privileges to read/add/edit items with elevated privileges with below code.
    but make sure the page which you add this web part have at least read access to all user.
    SPSecurity.RunWithElevatedPrivileges(delegate()
    using (SPSite site = new SPSite(web.Site.ID))
    // implementation details omitted
    More: http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.spsecurity.runwithelevatedprivileges.aspx
    Bistesh
    Ok after adding :-
    SPSecurity.RunWithElevatedPrivileges(delegate()
    users with the following permissions can create items:-
    "AddListItems, ViewPages, ViewFormPages, Open";
    and they can not edit/read them, which is great. but i am facing a caching problem , because if user is inside the "Intranet visitor" he will be able to see Category field as mentioned in my code, but if i remove him from the "Intranet Visitor"
    he still can see the field,, although in the web part i specify not to display the Category column if the user is not inside the "Intranet visitor " group... here is my current code:-
    protected override void OnInit(EventArgs e)
    base.OnInit(e);
    InitializeControl();
    SPSecurity.RunWithElevatedPrivileges(delegate()
    using (SPSite site = new SPSite(SPContext.Current.Site.Url))
    using (SPWeb web = site.OpenWeb())
    web.AllowUnsafeUpdates = true;
    SPGroup group = web.Groups["Intranet Visitor"];
    bool isUser = web.IsCurrentUserMemberOfGroup(group.ID);
    if (!isUser)
    SPList myList = web.Lists.TryGetList("Risk & Issue Management");
    SPField titleField = myList.Fields.GetField("Category");
    titleField.Hidden = true;
    titleField.ShowInEditForm = false;
    titleField.ShowInNewForm = false;
    titleField.ShowInDisplayForm = false;
    titleField.Update();
    myList.Update();
    // web.AllowUnsafeUpdates = false;
    else
    SPList myList = web.Lists.TryGetList("Risk & Issue Management");
    SPField titleField = myList.Fields.GetField("Category");
    titleField.Hidden = false;
    titleField.ShowInEditForm = true;
    titleField.ShowInNewForm = true;
    titleField.ShowInDisplayForm = true;
    titleField.Update();
    myList.Update();
    web.AllowUnsafeUpdates = false;
    so can you advice please ? is this a caching problem, or once the user add at-least single item he will be able to see all columns ?

  • Create custom web-part page with OOTB page layout using CSOM (Javascript)

    Hi,
    I need to create a custom webpart page with a OOTB page layout (eg. Header 3 column footer) using JSOM.
    I found a link to do this using CSOM: http://spdevlab.com/2013/03/28/creating-wiki-web-part-and-publishing-pages-via-csom-in-sharepoint-2010/
    But here i have to copy the page template from 15 hive and store it in a resource file and I am also getting error as "The request message is too big" and to fix this I need to run a powershell script but I need the code to run in SharePoint online
    also.
    Isn't there a simpler piece of code in which I can enter the name of the page layout(OOTB/Custom) while creating a page in JSOM as we have in SSOM?
    Thanks for the help
    sunny

    Hi,
    According to your post, my understanding is that you want to create a custom web part page layout template.
    There are some articles about how to create the custom web part page layout template, you can refer to them.
    http://www.manageprojectsonsharepoint.com/blog/2011/03/14/creating-your-own-web-part-page-layout-template/
    http://sandeeppawar.blogspot.com/2012/06/create-custom-web-part-page-template.html
    http://doitwithsharepoint.blogspot.com/2011/08/create-web-part-pages-with-custom.html
    Thanks & Regards,
    Jason
    Jason Guo
    TechNet Community Support

  • How to add element web Word in SharePoint Online

    Hey how are you?
    Currently I have Office 365
    I create a Sharepoint site
    and add a web part to see the conetendio
    an exel file, the web part
    is working correcamente me.
    I'm trying to add a web part to
    the contents of a Word file but can not find
    the option.
    anyone can help me to add the web part
    to Word?
    thanks

    SPUser user = SPContext.Current.Site.RootWeb.EnsureUser(*loginname*);
    Guid siteID = SPContext.Current.Site.ID;
    Guid webID = SPContext.Current.Web.ID;
    using (SPSite site = new SPSite(siteID))
    using (SPWeb web = site.OpenWeb(webID))
    try
    web.AllowUnsafeUpdates = true;
    //Get the group for this web
    SPGroup oeGroup = web.Groups[*myGroupName*];
    if (oeGroup == null) return false;
    //Add the User to the OE Group
    oeGroup.AddUser(user);
    oeGroup.Update();
    catch (Exception ex)
    //Error Handling
    finally
    web.AllowUnsafeUpdates = false;
    }http://sharepoint.stackexchange.com/questions/24966/adding-spusers-to-spgroups-programmatically-changes-user-idhttp://www.microsoft.com/en-us/download/details.aspx?id=17069

  • Implementing Exception Handling Application Block in custom web parts, event receivers

    hi,
      I am currently implementing try {} catch(Exception expp) { throw expp;} to handle exceptions in my intranet appln.
    I have several custom web parts, event receivers, few console applciations as timer jobs etc. If i want to implement a  robust exception handling what should be  the approach. by searching, i saw, ms patterns n practices provides the
    appln blocks.
    But I think[ pls correct me if i am wrong ] those  appln blocks are meant for asp.net applns ONLY.
    if not, anyone has implemented those appln blocks in SP development? if yes, can anyone provide one sample /  link to implement Exception Handling in SP.
    help is appreciated! 

    Hi,
    Here are some articles for your reference:
    Handling Error Centrally in a SharePoint Application
    http://www.codeproject.com/Articles/26236/Handling-Error-Centrally-in-a-SharePoint-Applicati
    Using Microsoft Enterprise Library Application Block in SharePoint
    http://www.codeproject.com/Articles/21389/Using-Microsoft-Enterprise-Library-Application-Blo
    Exception Handling in SharePoint
    http://spmatt.wordpress.com/2012/02/01/exception-handling-in-sharepoint/
    Best Regards
    Dennis Guo
    TechNet Community Support

  • SharePoint Online External Users

    So I was taking SharePoint online for a test drive a few days ago. While I was looking at how users are given permissions to list and libraries I realize something that might
    make or break SP Online for me. The out-of-the-box SharePoint Online implementation gives you one private site collection and one public website. Let just focus on the public website in this example. Now, by default the public website is at least viewable
    to everyone. But what if I created a survey on my public website and only wanted members of the site to have access to it. I know that you can "Share Site" with external users. But can you allow visitors to your site the ability to create their own account,
    and in turn fill out the survey? And of course without purchasing a license for every person filling the survey.
    Jeffrey T McFarland

    I'm not sure about making content on your public site private, but you can make content on your private sites public.  You basically turn on external users for the entire Office 365 SharePoint Online account.  Then you can optionally disable it
    for certain site collections.  That way, you can control who has access to what.  This article might be helpful in explaining how external users works in SharePoint Online: 
    http://office.microsoft.com/en-us/sharepoint-online-enterprise-help/share-a-site-with-external-users-HA102476183.aspx

  • How to enable a custom web part class file to be refreshed at regular interval of time, without affecting the entire page where its placed.

    Hi,
    I am calling a web service in the web part class file where it gets the data. I need to call the service at regular intervals of time which is in the web part, is there a way to get the web part refreshed automatically at certain intervals of time.
    Rayudu

    You can use Ajax for automatic refreshing.
    Add a timer control into an Ajax Update panel within your custom web part and execute your code to refresh the field values within the Timer_Tick() event.
    You can also control the timer interval to 10 minutes or so using the Timer.Interval property.
    This will always enable your page to remain with only the web parts getting refreshed.
    I just found
    a blog post which describes this in detail with screenshots.

Maybe you are looking for

  • Printer for Old iMac with OS8.6

    I'm trying to help a friend with an iMac DVD running OS 8.6.  They need to get a new printer.  Are there any printers that will run with OS 8.6 or can the old iMac be updated with an earlier version of OSX?  Help! Thanks!

  • Event Handling in OADialogPage

    Hi, I have a scenario for my project. where user should get a alert message with Ok(Proceed) and Cancel Buttons, when the budget for ticket is insufficient. After the alert, if user clicks on "Proceed", then it should navigate to confirmation page. I

  • Hp mini 110-1100 ram

    I was wondering if the ram can be expanded to 2 gigs

  • What areas to look ,when the application causes the Oracel Sqlplus to Hang

    we got an application that suddenly hangs and after that we are no longer able to connect through SQLplus.What should i look for.

  • Multi monitor on xp partition

    I'm having a problem with setting multi-monitor for the xp side partition. I use xp most of the time and having problem with the multi screen. please help thanks guys