Quantcast
Channel: SharePoint 2013 - Development and Programming forum
Viewing all 25064 articles
Browse latest View live

SharePoint Office365 Signin issue using CSOM

$
0
0

I am trying to connect and retrieve a List from my Office365 sharepoint portal through CSOM. In document.ready function of jquery I am calling an ajax call. I am using the below code and its working fine.

[WebMethod]
public static List<myClass> GetDataOnPageLoad()
{
    List<myClass> objmyClass = new List<myClass>();
    string strSiteCollection = "<Site Url>";
    string login = "<username>";
    string password = "<password>";
    SecureString securePassword = new SecureString();
    foreach (char c in password)
        securePassword.AppendChar(c);
    try
    {
        ClientContext Clientcontext = new ClientContext(strSiteCollection);
        Clientcontext.Credentials = new SharePointOnlineCredentials(login, securePassword);
        DataTable dtData = new DataTable();
        dtData.Columns.Add("ID", typeof(string));
        dtData.Columns.Add("UserEmail", typeof(string));
        dtData.Columns.Add("InstalledVersion", typeof(string));
        if (Clientcontext != null)
        {
            List docList = Clientcontext.Web.Lists.GetByTitle("<List Name>");
            Microsoft.SharePoint.Client.ListItemCollection items = docList.GetItems(CamlQuery.CreateAllItemsQuery());
            Clientcontext.Load(items);
            Clientcontext.ExecuteQuery();
            foreach (var item in items)
                dtData.Rows.Add(item["ID"].ToString(), item["UserEmail"].ToString(), item["InstalledVersion"].ToString());
        }
        if (dtData != null && dtData.Rows.Count > 0)
        {
            for (int i = 0; i < dtData.Rows.Count; i++)
            {
                //binding list
            }
        }
    }
    catch (Exception ex)
    {

    }
    return objmyClass;
}

All good till now.

Now I in another project I need this same code. So I copied it and pasted in the new project. Included the sharepoint client dll. Calling this from ajax. Now when I am running this new project it gives an exception from Clientcontext.ExecuteQuery(); Exception says : The partner returned a bad sign-in name or password error. For more information, see Federation Error-handling Scenarios.

I searched for this error but it didn't helped. I'm running the two projects side by side. The old one is running perfectly but the new one is getting the above said error. Please help.

Thanks & Regards.


Regards Pradeep(PKM)


Error occurred in deployment step 'Recycle IIS Application Pool': A task was cancelled.

$
0
0

Dear All, 

I would like to search for your help on this issue regarding deploy solution from Visual Studio 2013  to Sharepoint 2013. 

Previously, I am able to direct deploy the solution successfully from Visual Studio 2013 to Sharepoint 2013.

However, these few days I have encountered the error message "Error occurred in deployment step 'Recycle IIS Application Pool': A task was canceled. " when I try to deploy the solution to SharePoint. I didn't change any setting in Visual Studio and SharePoint. 


Currently, I just able to use Sharepoint 2013 Management Shell to write command and deploy the solution to my SharePoint. It's working fine if I am using the Sharepoint 2013 Management Shell to deploy the solution. 

Unfortunately, I cannot debug my coding due to cannot deploy the solution from Visual Studio 2013  to Sharepoint 2013. I am suspect that my server has canceled my task when I try to deploy the solution, but I don't know what happened to my server since I didn't change anything.

Appreciate if anyone can help on this issue. 

Thank you very much. 

Best Regards, 

<g class="gr_ gr_22 gr-alert gr_spell gr_inline_cards gr_run_anim ContextualSpelling ins-del multiReplace" data-gr-id="22" id="22">Lisalau</g>

Error occurred in deployment step 'Recycle IIS Application Pool': A task was cancelled.

$
0
0

Dear All, 

I would like to search for your help on this issue regarding deploy solution from Visual Studio 2013  to Sharepoint 2013. 

Previously, I am able to direct deploy the solution successfully from Visual Studio 2013 to Sharepoint 2013.

However, these few days I have encountered the error message "Error occurred in deployment step 'Recycle IIS Application Pool': A task was canceled. " when I try to deploy the solution to SharePoint. I didn't change any setting in Visual Studio and SharePoint. 

Currently, I just able to use Sharepoint 2013 Management Shell to write command and deploy the solution to my SharePoint. It's working fine if I am using the Sharepoint 2013 Management Shell to deploy the solution. 

Unfortunately, I cannot debug my coding due to cannot deploy the solution from Visual Studio 2013  to Sharepoint 2013. I am suspect that my server has canceled my task when I try to deploy the solution, but I don't know what happened to my server since I didn't change anything.

Appreciate if anyone can help on this issue. 

Thank you very much. 

Make connection with MultiFactor Authentication enabled user with Client dlls

$
0
0

For the feature "Multi-factor Authentication", when we try to connect the site using code with Client Side Object Model dll, then we get the error related to sign-in incorrect username or password

We would like to know if there is a way we connect site with MFA user through code i.e. with c# code for Windows Application or if there is any Azure Api, which can help us that while making the connection we remove the users from the MFA group

Custom Field Type that inherits from SPFieldLookup

$
0
0

hello

I am creatinga customfieldtypethatinherits from alookup.Wellbelowthe codeofVaireclasses:

-Theclass that derives fromSPFieldLookup

           

namespace CustomTypeFieldLkUpFilter.CustomControlsCTFFilter
{
    class CustomTypeFieldLkUpFilter : SPFieldLookup
    {
        public CustomTypeFieldLkUpFilter(SPFieldCollection fields, string fieldName) : base(fields, fieldName) { }

        public CustomTypeFieldLkUpFilter(SPFieldCollection fields, string fieldName, string displayName) : base(fields, fieldName, displayName) { }


        /// <summary>
        /// metodo che definisce come renderizza il controllo sulla form page
        /// </summary>
        public override BaseFieldControl FieldRenderingControl
        {
            [SharePointPermission(SecurityAction.LinkDemand, ObjectModel = true)]
            get
            {

                BaseFieldControl ctr = new CustomTypeFieldLkUpFilterControl();
                ctr.FieldName = this.InternalName;

                return ctr;
            }
        }

        public override object GetFieldValue(string value)
        {
            if (string.IsNullOrEmpty(value))
                return null;
            SPFieldLookupValueCollection field = new SPFieldLookupValueCollection();
            SPFieldLookupValue newValue = new SPFieldLookupValue(1, "aaa");
            field.Add(newValue);
            newValue = new SPFieldLookupValue(2, "bbb");
            field.Add(newValue);
            return field;
        }

        public override void OnAdded(SPAddFieldOptions op)
        {
            base.OnAdded(op);
            Update();
        } 
        public override string GetValidatedString(object value)
        {
            if ((this.Required == true)
               &&
               ((value == null)
                ||
               ((String)value == "")))
            {
                throw new SPFieldValidationException(this.Title
                    + " must have a value.");
            }

            return String.Format("{0}", value);

        }

        public override void Update()
        {
            SPSecurity.RunWithElevatedPrivileges(delegate()
            {
                using (SPSite site = new SPSite(SPContext.Current.Web.Url))
                {
                    using (SPWeb web = site.OpenWeb())
                    {
                        SPList list = web.Lists["Misure"];
                        base.LookupList = list.ID.ToString();
                        base.LookupField = "Title";
                        base.AllowMultipleValues = true;
                        base.LinkToItemAllowed = ListItemMenuState.Allowed;
                        base.LinkToItem = true;
                        base.Update();
                    }
                }
            });


        }
    }
}

-- the  XML file fldtypes_CustomTypeFieldLkUpFilter.xml

<?xml version="1.0" encoding="utf-8" ?>
<FieldTypes>
  <FieldType>
    <Field Name="TypeName">CustomTypeFieldLkUpFilter</Field>
    <Field Name="TypeDisplayName">Custom Type Field LkUp Filter</Field>
    <Field Name="TypeShortDescription">CustomTypeFieldLkUpFilter</Field>
    <Field Name="ParentType">LookupMulti</Field>
    <Field Name="UserCreatable">TRUE</Field>
    <Field Name="FieldTypeClass">CustomTypeFieldLkUpFilter.CustomControlsCTFFilter.CustomTypeFieldLkUpFilter, $SharePoint.Project.AssemblyFullName$</Field>
    <Field Name="Sortable">TRUE</Field>
    <Field Name="Filterable">TRUE</Field>
  </FieldType>
</FieldTypes>

-- the user control ascx CustomTypeFieldLkUpFilterControl.ascx

    

<%@ Assembly Name="$SharePoint.Project.AssemblyFullName$" %>
<%@ Assembly Name="Microsoft.Web.CommandUI, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
<%@ Register TagPrefix="SharePoint" Namespace="Microsoft.SharePoint.WebControls" Assembly="Microsoft.SharePoint, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
<%@ Register TagPrefix="Utilities" Namespace="Microsoft.SharePoint.Utilities" Assembly="Microsoft.SharePoint, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
<%@ Register TagPrefix="asp" Namespace="System.Web.UI" Assembly="System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" %>
<%@ Import Namespace="Microsoft.SharePoint" %> 
<%@ Register TagPrefix="WebPartPages" Namespace="Microsoft.SharePoint.WebPartPages" Assembly="Microsoft.SharePoint, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
<%@ Control Language="C#" %>


<SharePoint:RenderingTemplate runat="server" ID="SRBaseFiledControlforEdit">
    <Template>
        <h1>SRBaseFiledControlforEdit</h1>
        <asp:Literal runat="server" ID="ltrlFieldValue"></asp:Literal>
        <asp:TextBox ID="inputTexTBox" runat="server"></asp:TextBox>
    </Template>

</SharePoint:RenderingTemplate>
<SharePoint:RenderingTemplate runat="server" ID="SRBaseFiledForDisplay">
    <Template>
            <h1>SRBaseFiledForDisplay</h1>
        <asp:Literal runat="server" ID="ltrlFieldValue"></asp:Literal>
   </Template>
</SharePoint:RenderingTemplate>

-- la class control CustomTypeFieldLkUpFilterControl.cs

namespace CustomTypeFieldLkUpFilter.CustomControlsCTFFilter.Controls
{
    class CustomTypeFieldLkUpFilterControl : BaseFieldControl
    {

        protected Literal ltrlFieldValue;
        protected TextBox inputTexTBox;
        #region Metodi in override

        protected override void CreateChildControls()
        {
            base.CreateChildControls();


            if (ControlMode == SPControlMode.Display)
            {
                InitializeView();
                return;
            }

            if (this.Field != null && this.ControlMode != SPControlMode.Invalid)
            {
                InitializeEdit();
                inputTexTBox.Text = "cornuto";
            }

        }

        protected override string DefaultTemplateName
        {
            get
            {
                if (this.ControlMode == SPControlMode.Display)
                {
                    //visualizza nel Displayform
                    return this.DisplayTemplateName;
                }
                else
                {
                    //visualizza negli altri form
                    return "SRBaseFiledControlforEdit";
                }
            }
        }

        public override string DisplayTemplateName
        {
            get
            {
                return "SRBaseFiledForDisplay";
            }
        }

        public override object Value
        {
            get
            {
                EnsureChildControls();
                SPFieldLookupValueCollection field = new SPFieldLookupValueCollection();
                SPFieldLookupValue newValue = new SPFieldLookupValue(1, "aaa");
                field.Add(newValue);
                newValue = new SPFieldLookupValue(2, "bbb");
                field.Add(newValue);
                //ltrlFieldValue.Text = "set Interno";
                return field.ToString(); 
            }
            set
            {
                //SPFieldLookupValueCollection lkpValueCollection = (SPFieldLookupValueCollection)this.ItemFieldValue;
                //extendedLookupValue.Value = lkpValueCollection.ToSemicolumnSeparatedLookupIds();
                //extendedLookupTextBox.Text = lkpValueCollection.ToSemicolumnSeparatedLookupValues();
                EnsureChildControls();
                ltrlFieldValue.Text = value.ToString();
            }
        }


        public override void UpdateFieldValueInItem()
        {
            //string ppp = inputTexTBox.Text;



            base.UpdateFieldValueInItem();
        }

        #endregion


        private void InitializeView()
        {
            ltrlFieldValue = (Literal)this.TemplateContainer.FindControl("ltrlFieldValue");
            if (ltrlFieldValue == null) throw new ArgumentException("Literal ltrlFieldValue non trovata");
        }

        private void InitializeEdit()
        {
            ltrlFieldValue = (Literal)this.TemplateContainer.FindControl("ltrlFieldValue");
            if (ltrlFieldValue == null) throw new ArgumentException("Literal ltrlFieldValue non trovata");
            inputTexTBox = (TextBox)this.TemplateContainer.FindControl("inputTexTBox");
            if (inputTexTBox == null) throw new ArgumentException("TextBox inputTexTBox non trovata");
        }
    }
}

AS YOU CAN SEEIN THEMETHODGETTHEVALUECREATEDASPFieldLookupValueCollection

WELLTHECOLUMNDOESBRINGTHE VALUESCORRECTLY, BUT WHENI GOON THESHOWISALLITEMS.APSX LISTBELOW

HAVE SOMETIPS

HELLO


Error while running Configuration Wizard in SharePoint 2013: Exception in RefreshCache. Exception message :The '?' character, hexadecimal value 0x43A0, cannot be included in a name. Line 1, position 5694.

$
0
0

Hi Friends,

I was trying to run configuration wizard in SharePoint 2013 Central Administration and I got below error:

Exception in RefreshCache. Exception message :The '?' character, hexadecimal value 0x43A0, cannot be included in a name. Line 1, position 5694.

Yesterday my SharePoint server was running fine and today when I try to update a SharePoint solution (wsp) I got same error. Even if I try to do any operation in Central administration like adding new WSP, Updating WSP , I get same error.

Does any one have any Idea?

Regards

Gireesh Painuly

How to get current user session on SharePoint and call and REST API Net Core with the same authentication data?

$
0
0

Hello,

I have a SharePoint WebPart (I am using SharePoint 2013, SharePoint WebPart 2013 and jQuery) and a Net Core REST API (with Windows Authentication enabled). 

I would like to know if there is a way to pass the authentication data  of the current user logged in SharePoint to the rest API. I mean, the final goal is ensure the user (on SharePoint) who is calling the REST API is a valid Windows User.

Thank you!


Rendering Custom SPFieldLookup

$
0
0

I extended the SPFieldLookup class and have problems by the rendering on client side. I overrodeGetFieldValueAsHtml, GetFieldValueAsText and RenderFieldValueAsJsonbut only GetFieldValueAsHtml is called. GetFieldValueAsText and RenderFieldValueAsJsonare never called.

On the client side rendering I've seen that the output depends by the javascript type of the data. GetFieldValueAsHtml returns a html, actually a string, so it is rendered as a string. The call for a standard SPFieldLookupcolumn returns a Json object like the following:

{ isSecretFieldValue: false,
  lookupId: 1,
  lookupValue: "Test" }
What do I have to do in order to get this result in a custom SPFieldLookup? Please note: I don't want to write JS code on the client.



Yammer Share to specific Group

$
0
0

Hi Everybody,

I have one requirement to share my sharepoint page to yammer as post. 

I am able to do it. but by default it is posting to "all Company" Group .I would like to  share or post it to a specific group like "HR team". How can I achieve this 

Thanks in advance, Your help will be appreciated 

SharePoint 2013 List Header Row Freeze

$
0
0

Hello, I've a long list in my site. When I scroll down then the headers are not appearing. That's why every time users should scroll-up and down. As I researched I've found a script which freezes the header row even you scroll-down. 

However, I am a very beginner in SharePoint developing. The script which I apply is below. When I apply then it doesn't make any sense. I've just changed the table id and inserted into a content editor. Can you tell me that what I'm doing wrong?

Thanks in advance.

<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.2.6/jquery.min.js" type="text/javascript"></script><style type="text/css"><!--
.DataGridFixedHeader { ; top: expression(this.offsetParent.scrollTop);}
--></style><script type="text/javascript">
$(function(){
var $table = $("TABLE[ID^='{4C9CFF20-B467-4E10-820C-0A132442CF98}']:first", "#MSO_ContentTable");<!--WRAP TABLE IN SCROLL PANE-->
$table.wrap("<DIV style='OVERFLOW: auto; HEIGHT: 420px'></DIV>");<!--FROZEN HEADER ROW-->
$("TR.ms-viewheadertr:first", $table).addClass("DataGridFixedHeader");
});</script>


KAdir


Business Connectivity Services SP2013 (cloud)

$
0
0

Hi folks,
I've been trying to create an 'External Content Type' in SharePoint Designer 2013, but get an error:

'The Business Data Connectivity Metadata Store is currently unavailable'

Our SharePoint is cloud hosted so not on prem. I've been all round the internet trying to find some info on this but to no avail. Most solutions point towards having an on prem SharePoint server farm which has an admin panel where it can be turned on, but no such thing in the cloud version. 

In SharePoint, if trying to add a new External list and selecting a data source it gives the error:

'External content types are not available. Contact your system administrator'

So putting the feelers out there to see if anyone can point me in the direction for how to enable this and if it actually can be enabled?

I've attached some screen shots.

Thanks

AR

Is there a way to add blog to the existing team site in SP O365?

Using PowerShell to fetch SharePoint data

$
0
0

Hi,

I'm pretty new at PowerShell. I'm trying to fetch data form a SharePoint site, but get the following error when using the command "Get-SPOSite https://sharepoint.site.com":

Connect-SPOService : Could not connect to SharePoint Online: unsupported version of service.
At line:1 char:1
+ Connect-SPOService https://sharepoint.site.com/x/
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Connect-SPOService], InvalidOperationException
    + FullyQualifiedErrorId : System.InvalidOperationException,Microsoft.Online.SharePoint.PowerShell.ConnectSPOService

What may be the reason for this?

thanks,


Difference between 2 dates in Year, Month & Days format

$
0
0

Difference between 2 dates in Year, Month & Days format

One column have issue date = 20/08/2018

2nd column have End Date = 28/03/2026

We required period of this document in Year, month & Day format. 

How do I map the C:\Program Files\Common Files\microsoft shared\Web Server Extensions\16\TEMPLATE\_Layouts\sample3.1.0 folder to http://abcd/_layouts/15/sample3.

$
0
0

Hi,

In SharePoint 2016, for http://abcd web application, unable to find sample3 folder in Url: http://abcd/_layouts/15/sample3/main.js. Actual folder name is sample3.1.0 in File Path: C:\Program Files\Common Files\microsoft shared\Web Server Extensions\16\TEMPLATE\_Layouts\sample3.1.0\main.js.

How do I map the C:\Program Files\Common Files\microsoft shared\Web Server Extensions\16\TEMPLATE\_Layouts\sample3.1.0 folder to http://abcd/_layouts/15/sample3.

Your reply will be greatly appreciated.

Thanks in advance. 


Return only the list of sites to which user has access

$
0
0

I have the following code and trying to populate the dropdownlist with only the list of sites to which the user has access. When the user accesses the page, they see all the site and when the click on the ones to which they do not have access they are prompted with the page to request access to the site. How do I modify the code to only show the list of sites that the user has permission

 protected override void OnPreRender(EventArgs e)
        {
            string permission = string.Empty;
            ddSites.Items.Clear();

            SPSecurity.RunWithElevatedPrivileges(delegate()
                      {

                          using (SPSite siteColl = new SPSite("http://*******/"))
                          {
                              if (siteColl.RootWeb.DoesUserHavePermissions(SPContext.Current.Web.CurrentUser.LoginName, SPBasePermissions.Open))
                              {

                                   {
                                      foreach (SPWeb oWeb in siteColl.RootWeb.GetSubwebsForCurrentUser())
                                      {
                                          ddSites.Items.Insert(0, new ListItem("Please Select a Site", "0"));
                                          foreach (SPWeb web in siteColl.AllWebs)
                                          {
                                              try
                                              {

                                                  ddSites.Items.Add(new ListItem(web.Title, web.ID.ToString()));

                                              }
                                              finally
                                              {
                                                  web.Dispose();
                                              }
                                          }

                                          if (!selectedSiteGuid.Equals(Guid.Empty))
                                          {
                                              ddSites.Items.FindByValue(selectedSiteGuid.ToString()).
                                              Selected = true;

                                            
                                          }
                                      }
                                  }
                              }
                          }
                      });
        }


IPW

Item Added Event Receiver for Document Library

$
0
0

Hi,

Created Item Added event receiver for a SharePoint 2013 document library but it is not working as expected. When I tried to debug the code, it's not hitting the break point and I can see the following message.

"The breakpoint will not currently be hit. No symbols have been loaded for this document"

May I know what could be the reason?

Any help would be greatly appreciated.

Thank you,


OK29

What code should I use to display full photo in thumbnails of picture library

$
0
0

Hey guys,

I have a picture library where some of the images are very similar and only have some branding differences in the top right. Right now these similar images appear identical in the thumbnails because the thumbnail is centered and it doesn't reach the top right/left/sides of a picture.

How can I have the thumbnail show the full photo? The photo should resize to fit itself in the confines of the thumbnail.

I found some recommended code in this article but it's not working well for me:  https://sharepoint.stackexchange.com/questions/228909/show-full-thumbnails-in-picture-library

It helps for some images but still appears to be center-aligning and doesn't work for all. Also, when I use this code with Hillbilly tabs, it prevents the tabs from working, i.e. the content just disappears. Note, this is the hillbilly tabs feature:  http://www.sharepointhillbilly.com/Lists/Posts/Post.aspx?ID=42

In summary, my picture library is a web part on a page (part of the tabs feature) and I need code that will show the full photo in the thumbnail, while not breaking the Hillbilly tabs feature. Thank you in advance for your help! I know this one is tricky... I really appreciate your time and assistance!!




Not able to edit 'Advanced properties' of chart web part

$
0
0

Hi 

I have created a chart web part, when I try to edit the chart properties using 'Advanced properties' option, I have been provided with various elements & its respective properties in a table format but when I click on any property, nothing happens.

Here is my issue to be specific , I have a data source like, 

Date         D1       D2      D3

8/20/17    20        25      30

8/21/17    23        28       32

I am trying to plot this in a bar chart with the date on X axis & D1, D2, D3 on Y-axis, I have no problems in inserting or connecting to data sources, but I have two problems in the plot,

1) When I display this chart, it only takes data from only one column apart from Date. So, it shows Date & respective D1 or D2 or D3 only not all at once (I am giving the correct range when I connect this source)

2) When the chart is displayed, the date axis is showing in 'numbers' instead of 'date'. While I searched about this, I got to know that I have to edit the 'XValueType' property from 'Auto' to 'Date' in the 'Series' element in 'Advanced properties', for that I am unable to edit that property, when I click on the drop down, nothing happens.

Thanks for the help.


HrGetRequestingUser - Autonomous IRM Protector - Catastrophic Failure

$
0
0

Hello everyone, 

I'm developing an autonomous IRM protector for SharePoint Server 2013. It works fine so far excluding the usage of HrGetRequestingUser. Whenever I try to use this function in HrProtect or HrUnprotect the returned HRESULT is "Catastrophic Failure" and the user email is obviously not returned.

I looked around at my server and saw that I forgot to sync the server with the AD. But even after I did that I still get the error. Is there something I might have mis-configured in the server? How do I remedy this?

Thanks!

Viewing all 25064 articles
Browse latest View live


Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>