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

Share SubSite with Office 365 Group programmatically with REST

$
0
0

Hello,

is there a way to share a SubSite with a Office 365 Group via REST.

At the moment I cannot retrieve information about the group when I call

var restSource = appweburl + "/_api/SP.UI.ApplicationPages.ClientPeoplePickerWebServiceInterface.clientPeoplePickerResolveUser";

Is there a other way to achive this?


How can I trigger SharePoint Site workflow from another Site Workflow using REST API ?

$
0
0

In SharePoint Online we have two site workflows.

In the end stage one site workflow I want to call another site workflow using REST API. Is it possible to do so?



javascript: Detect Edit Mode in SharePoint Online

$
0
0

I've got some JavaScript embedded into a SharePoint webpart page. I need to detect if the user is in Edit mode.

I have tried using the following code to target the "MSOLayout_InDesignMode" input field, however that field always has a value of empty, regardless of what mode I am in.

var inDesignMode = document.forms[MSOWebPartPageFormName].MSOLayout_InDesignMode.value;

if (inDesignMode == "1")
{
    // page is in edit mode
}
else
{
    // page is in browse mode
}
MSOLayout_InDesignMode has empty value.

SharePoint 2013 - Exchange 2013 integration

$
0
0

Hi,

I'm doing SharePoint 2013 development (Farm solution) on a VM on my desktop with SP & DC & SQL on it.

Now I need to test the integration with Exchange 2013 (calendar & tasks) and SP email.

I would like to install and configure Exchange on my VM in order to have the environment completed and isolated.

How can I install and configure Exchange (and Exchange integration with SP) on my VM?

thank you so much,

JD

Who will be crowned the First SharePoint Guru of 2017!!

$
0
0

Time for a fresh start!

[The Guru is the means of realisation. "There is no knowledge without a teacher."]

We're looking for the first Gurus of 2017!!

All you have to do is add an article to TechNet Wiki from the field of your interest. Something that fits into one of the categories listed on the submissions page. Copy in your own blog post, a forum solution, a white paper, or just something you had to solve for your own day’s work today.

A snippet you share can make you a January 2017 TechNet Wiki Guru in your favorite category and this is official Microsoft TechNet recognition!

HOW TO WIN 

Please copy over your Microsoft technical solutions and revelations to TechNet Wiki.

Add a link to it on THIS WIKI COMPETITION PAGE (so we know you’ve contributed).

Every month, we will highlight your contributions, and select a "Guru of the Month" in each technology.

If you win, we will sing your praises in blogs and forums, similar to the weekly contributor awards. Once "on our radar" and making your mark, you will probably be interviewed for your greatness, and maybe eventually even invited into other inner TechNet/MSDN circles!

Winning this award in your favorite technology will help us learn the active members in each community. 

Feel free to ask any questions below.

More about TechNet Guru Awards.


Thanks,

If my reply is helpful please mark as Answer or vote asHelpful.

My blog | Twitter | LinkedIn

This post is my own opinion and does not necessarily reflect the opinion or view of Microsoft, its employees, or other MVPs.

Download older version of a file from SharePoint Document Library using CSOM

$
0
0

Download older version of a file from SharePoint Document Library using CSOM in asp.net mvc c#

Checkbox event + jQuery

$
0
0
Hi All,

I have two types of Checkbox1(options 1,2,3) and Checkbox2(options 3,2,1) in the form and please help me on the below issues using jQuery.

1) How to select only checkbox1 options? (If I select any option in checkbox1, no option should be selected in the checkbox2)
2) How to allow only one option?(If I select the option1, option 2 or 3 should be uncheched)

I am using below script to check the option.

<script src="//code.jquery.com/jquery-3.1.0.min.js" type="text/javascript"></script>
<script type="text/javascript">
$(function () {  

    $("#checkbox1").on('click', function(){
alert('choice');
        $("input[type='checkbox']").prop('checked', true).change();
    });
});
</script> 

Let me know if you need any information.

Thanks In Advance,
Kumar

Passing Information between InfoPath forms in SP 2013 help

$
0
0

I am fairly new to InfoPath and am looking for a possible solution for one of our Project Managers. Here is what they are asking about:

1. Create a form within a SharePoint 2013 form library with 20 total questions in the form. 10 questions (activated when the employee opens the form) and 10 questions (hidden from the employee when they open the form) which will be activated after the employee clicks the Submit button.

  • The Employee will open the form and answer their 10 questions and click on the Submit button.
  • Clicking Submit on the Employee's form will submit the employee answers, activate the second set of 10 questions and notify the Manager that the form is available for them to fill out.
  • The Manager then opens the form in which they can see the employee answers and fills out their portion of the form.
  • Clicking Submit on the Manager's form will create a PDF file which displays all answers from both the employee and the manager and sends the file to the Manager's email address.

I need some assistance or guidance to a post in which this has been done before in order to build this solution. Any help would be greatly appreciated!

Thank you all!

VG


SharePoint sub site creation process

$
0
0

Hello,

I have to create my own site creation page just like newspweb.aspx. Can anyone help me out on this.

Any help would be appreciable

Thanks,

Kunal

Update Modified By User in Manifest.xml before Migrating to SharePoint Online

$
0
0

Hello,

I am trying to migrate documents from a file share to SharePoint Online using the Migration API.  I want to update the Modified By value on a document with a user in SPO, however, I am having issues setting the value to a new user.  The user does exist in SharePoint Online.

Here is what I am doing:

Running the following PowerShell command:

# Create new package from file share

New-SPOMigrationPackage -SourceFilesPath $sourceFiles -OutputPackagePath $sourcePackage -TargetWebUrl $targetWeb -TargetDocumentLibraryPath $targetDocLib -NoAzureADLookup 

When that is run, the following xml files are created:

UserGroups.xml

Manifest.xml

In the UserGroups.xml, I get the following:

<?xml version="1.0" encoding="UTF-8"?>

<UserGroupMap xmlns="urn:deployment-usergroupmap-schema">

  <Users>

    <User Flags="0" IsDeleted="false" SystemId="AQIAAAAAAAUgAAAAIAIAAA==" IsSiteAdmin="false" IsDomainGroup="true" Email="" Login="BUILTIN\Administrators" Name="" Id="1"/>

    </Users>

    <Groups/>

</UserGroupMap>

Notice the Id value = 1

In the manifest.xml, I get the following (just including a snippet):

<SPObject Url="/Accounting/test.doc" ParentWebUrl="/Accounting" ParentWebId="84ec82c5-4227-4579-ad19-bd8ca24873f4" ParentId="10394067-6044-46ad-b1c9-250f5a150359" ObjectType="SPFile" Id="6ad11bcf-45bb-4774-b8b9-f1ebc2b5872f">

<File Url="University/test.doc" ParentWebUrl="/Accounting" ParentWebId="84ec82c5-4227-4579-ad19-bd8ca24873f4" ParentId="10394067-6044-46ad-b1c9-250f5a150359" Id="6ad11bcf-45bb-4774-b8b9-f1ebc2b5872f" TimeLastModified="2014-11-03T22:38:56" TimeCreated="2016-11-21T22:39:21" Name="test.doc"ModifiedBy="1" Author="1" FileSize="49152" FileValue="test.doc" Version="1.0" ListId="e57e4293-e372-434e-a75b-85337c0bd15d" ListItemIntId="4"/>

</SPObject>

<SPObject Url="/Accounting/test.doc" ParentWebUrl="/Accounting" ParentWebId="84ec82c5-4227-4579-ad19-bd8ca24873f4" ParentId="e57e4293-e372-434e-a75b-85337c0bd15d" ObjectType="SPListItem" Id="fb35fc12-17ba-4faa-a4ce-14559fd2c7d1">

test.doc">

<Fields/>

</ListItem>

</SPObject>

Notice that the ModifiedBy="1"  and  Author="1" values are set to 1 …. Which I’m assuming maps to the id of the user in the UserGroups.xml

Anyway, if I were to change the UserGroups.xml file to the following:

<?xml version="1.0" encoding="utf-8"?>

<UserGroupMap xmlns="urn:deployment-usergroupmap-schema">

<Users>

<User Id="1" Name="Fred Flintstone" Login="fred@bedrock.onmicrosoft.com" Email=" fred@bedrock.onmicrosoft.com " IsDomainGroup="false" IsSiteAdmin="false" SystemId="AQIAAAAAAAUgAAAAIAIAAA==" IsDeleted="false" Flags="0" />

<User Id="2" Name="Barney Rubble" Login="barnie@bedrock.onmicrosoft.com" Email=" barnie@bedrock.onmicrosoft.com " IsDomainGroup="false" IsSiteAdmin="true" SystemId="AQIAAAAAAAUgAAAAIAIAAA==" IsDeleted="false" Flags="0" />

</Users>

<Groups />

</UserGroupMap>

And then modify the manifest xml to be ModifiedBy="2" Author="2",

I then run the following PowerShell commands:

# Convert package to a targeted one by looking up data in target site collection

ConvertTo-SPOMigrationTargetedPackage -SourceFilesPath $sourceFiles -SourcePackagePath $sourcePackage -OutputPackagePath $targetPackage -TargetWebUrl $targetWeb -TargetDocumentLibraryPath $targetDocLib -Credentials $Credential

- Submit Package to Azure:

$azurePkg = Set-SPOMigrationPackageAzureSource -SourceFilesPath $sourceFiles -SourcePackagePath $targetPackage -AzureQueueName $azureQueueName -AccountName $azureAccountName -AccountKey $azureAccountKey

Submit-SPOMigrationJob -TargetWebUrl $targetWeb -MigrationPackageAzureLocations $azurePkg -Credentials $Credential

.

Once the files are uploaded to Azure and then migrated to SharePoint Online, all the documents show up as being modified by Fred (User Id=1), instead of Barnie.

In the ConvertMigrationPackage logs, I find the following:

12/15/2016 11:10:58 PM Warning User node fred@patrickcompany.onmicrosoft.com was not sucessfully looked up, marking as deleted

12/15/2016 11:10:58 PM Warning User node barnie@patrickcompany.onmicrosoft.com was not sucessfully looked up, marking as deleted

Any ideas on what I am doing wrong.  Basically, I want to update the modified by with various users in SPO.  Any help would be greatly appreciated.


Sharepoint 2013 BCS | Association between SharePoint List and external content type

$
0
0

I have a requirement to build a relation between list and external content type

E.g.

List Name = Person and have following columns

Person ID

Name

External content type:

1) Create external content type from WCF service with following fields

Person ID

Salary

Now I want to create association between list and external content type on basis of person ID and salary would be auto populated in the list

List items are

1 VD

2 BC

3 GH

External content type is returning following

1 500

2 599

3 548

In the list salary would be auto populate like this.

1 VD 500

2 BC 599

3 GH 548

Please advise if it is feasible.

Dataset cache

$
0
0

Hi, i have a Devexpress grid in SharePoint, where i am pulling data from the Database. But the data updates daily to the database and i have written code to "cache dataset" to refresh grid for every 2 hours after database is updated, but looks like grid is not refreshing. But when i recycle app pool then it is working. Here is my code, but same code is working in my development. Please let me know to make any changes to code to refresh the grid for every 2 hours

                         

using System;
using System.Collections.Generic;
using System.Linq;
using System.Data;
using System.Data.SqlClient;
using System.Text;
using System.Threading.Tasks;
using System.Configuration;
using System.Runtime.Caching;
using System.Web.Caching;
namespace Grid
{
    public class GridDS
    {
        private bool _Loaded = false;
        private DataSet _ListDS = null;
        private string _ConnStr = string.Empty;

        public DataSet ListDS
        {
            get
            {
                return _ListDS;
            }
        }

        public bool IsLoaded
        {
            get
            {
                return _Loaded;
            }
        }

        public GridDS(string ConnStr)
        {
            _ConnStr = ConnStr;
             Loadtable();

        }

         private void Loadtable()
        {
            ObjectCache cache = MemoryCache.Default;
            string cacheKey = "RefreshData";
            DataSet dsreturn = new DataSet();

            if (cache.Contains(cacheKey))
            {
                dsreturn = (DataSet)cache.Get(cacheKey);
                if (dsreturn != null && dsreturn.Tables[0].Rows.Count > 0)
                {
                    dsreturn.Tables[0].PrimaryKey = new DataColumn[1] { dsreturn.Tables[0].Columns[0] };
                    _ListDS = dsreturn;
                }
            }
            else
            {
                dsreturn = LoadListDS();
                CacheItemPolicy itemPolicy = new CacheItemPolicy();
                itemPolicy.AbsoluteExpiration = DateTime.Now.AddHours(2.0);
                cache.Add(cacheKey, dsreturn, itemPolicy);
            }
        }

        private DataSet LoadListDS()
        {
            try
            {
                DataSet ds = new DataSet();
                SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["ConnStr"].ConnectionString);
                SqlCommand cmd = new SqlCommand("Users", con);
                SqlDataAdapter da = new SqlDataAdapter(cmd);
                con.Open();
                da.Fill(ds);
                con.Close();

                if (ds != null && ds.Tables[0].Rows.Count > 0)
                {
                    ds.Tables[0].PrimaryKey = new DataColumn[1] { ds.Tables[0].Columns[0] };
                    _ListDS = ds;
                }

                return ds;
            }
            catch (Exception ex)
            {
                throw new Exception("Error loading grid from db: " + ex.Message);

            }
      }

   }

}



powershell script to download

$
0
0

$FilePath =  "https://xxxl.com/clients/AllItems.aspx/ClientRepo.xlsx"
$localPath = "c:\test\ClientRep.xlsx"
$wc = New-Object System.Net.Webclient
$wc.UseDefaultCredentials = $true
$wc.Headers.Add("X-FORMS_BASED_AUTH_ACCEPTED", "f")
$wc.DownloadFile($FilePath, $localPath)

I am able to download Excel from sharepoint site with above script but unable to open Excel file ,  getting error message "format or file type is invalid",  when i try to download manually from site it works fine but trying to do through script giving error.  

do i need to specify any header information in above script

Thanks

V

CAML Query Where Items are Approved is Ignored

$
0
0
I am working with some custom web parts recently. Those web parts will only display items which have been already approved. To get the items, I use CAML Query and filter the modstat value like:

    <View ... >
        <Query>
        ...
            <Where>
                <Eq>
                    <FieldRef Name='_ModerationStatus' />
                    <Value Type='ModStat'>0</Value>
                </Eq>
            </Where>
        ...
        </Query>
    </View>
I passed the query to a XsltListViewWebPart programmatically. I also wrapped the code to populate the XsltListViewWebPart in SPSecurity.RunWithElevatedPrivileges (I have also tried remove the elevated privileges, but still no luck).

The strange thing is when I logged in as any user, the query worked fine and returned correct results (only approved items are displayed on the site). But when I access the site as an anonymous user, I could also see pending items (It feels like the where clause didn't work). Here is the web part on my .ascx page.

    <WebPartPages:XsltListViewWebPart
        ID="articleWebPart"
        runat="server"
        IsIncluded="true"
        PageType="PAGE_NORMALVIEW"
        ShowToolbarWithRibbon="false"
        >
    </WebPartPages:XsltListViewWebPart>

Any workaround on this case?

REST Api call for fetching the users from Distribution List

$
0
0

Hi,

I have added a specific Distribution List (e.g. ContosoAdmins) of AD as Site Collection Admin.

This ContosoAdmins consist of below listed user,

1. AdminUser1

2. AdminUser2

3. AdminUser3

While I am try to fetch these users by using below REST api call,

http://<SiteCollection>/_api/web/siteusers?$filter=IsSiteAdmin%20eq%20true

It only fetches ContosoAdmins details as response whereas expected result should fetch details of all 3 users i.e. AdminUser1, AdminUser2, AdminUser3.

Kindly help, if we have alternate rest api to fetch this expected result.


Hope this help.

Vote - if you find this helpful

Marked as Answer - if you see this reply being an answer to the question of the thread


Regards,

Amjad Khan

Blog: https://amjadk.com


i'm not able to show content of managed meta data field in a web part

$
0
0

Hello

i want to know how to show the content of amnaged meta data fielsd ina web part in sharepoint 2013?

i get an error message in splistitemcollection.getdatatable

can you help pleasE?

How to implement Encrypt Method in asp.net membership

$
0
0

Microsoft SqlMembershipProvider is used for form based authentication in SharePoint 2013. The password Format is Encrypted (Password Format is 2)

The default MachineKey Value in the Web.Config of Web Application is 
      <machineKey validationKey="----" decryptionKey="----" validation="HMACSHA256" />

I want to implement EncryptPassword method of SqlMembershipProvider. The encryptPassword method will have user entered Password as an argument and return value will be encrypted password which is stored in the membership database.

What is the purpose of "Update all related content types with these workflow association settings." when i have a global workflow that is connected to a content type ?

$
0
0

I have the following scenario inside my sharepoint server-2013 :-

1. using sharepoint designer i created a new reusable workflow 2010 linked to a custom content type (content type name is CT-A).

2. then i globally publish the reusable workflow, name it "global".

3. i set to run the workflow when item is created.

4. now i have a list which uses the content type CT-A.

5. i create a new item inside my list.

6. where the global workflow runs successfully.

7. so till now everything is working well.

now i wanted to updated my global workflow to add extra actions.

so i did the following:-

1. using sharepoint designer 2013.

2. i edit the global workflow

3. save / publish it

At this stage i thought that my modifications will not have any effect unless i click on the "Site Settings>>Site Content Types>>CT-A>>workflows>>Update all related content types with these workflow association settings. " link:-

but when i add a new item inside the list , the modification i made on the global workflow was applied to the list , without clicking on the above link ? so can anyone adivce on what is the purpose of the "Update all related content types with these workflow association settings."  link,, as seems modifying the global workflow, then save/publish it will also update the workflow on the list content types without the need to click on "Update all related content types with these workflow association settings."  link ?


Unable to disable a column inside the Quick Edit Grid using a WebPart JSLINK

$
0
0

I want to disable the Title column from the Quick Edit grid, inside certain web-parts so i did the following steps:-

1- I went to a list view.

2- Edit the page

3- Edit the web part.

4- Under the "Miscellaneous" tab

5- I add a reference to the following JSLink:-

(function () {

      function registerRenderer() {
        var ctxForm = {};
        ctxForm.Templates = ctxForm.Templates || {};;
        ctxForm.Templates.OnPreRender = function(ctx) {
        var statusField = ctx.ListSchema.Field.filter(function(f) {
            return f.Name === 'Title';
        });
        if (statusField.length>0) {
            statusField[0].AllowGridEditing = false;
        }
    }
        ctxForm.Templates = {
            Fields : {
                'LinkTitle': { //------ Change Hyperlink of LinkTitle
                    View : function (ctx) {
                        if(ctx.CurrentItem.SiteAutomaticallyCreated != null && ctx.CurrentItem.SiteAutomaticallyCreated === 'Yes'){
                        var url = String.format('{0}{1}', "/Programmes/", ctx.CurrentItem.ID);
                        return String.format('<a href="{0}" onclick="EditItem2(event, \'{0}\');return false;">{1}</a>', url, ctx.CurrentItem.Title);
                        }
                        else
                        {
                            var url = String.format('{0}{1}', "/Programmes/Lists/Projects/DispForm.aspx?ID=", ctx.CurrentItem.ID);
                        return String.format('<a href="{0}" onclick="EditItem2(event, \'{0}\');return false;">{1}</a>', url, ctx.CurrentItem.Title);
                        }
                    }
                },
            }
        };
        SPClientTemplates.TemplateManager.RegisterTemplateOverrides(ctxForm);
    }
    ExecuteOrDelayUntilScriptLoaded(registerRenderer, 'clienttemplates.js');


})();

But Title field will still be editable inside the quick edit grid, while the other part of my JS link (ctxForm.Templates) is working well. so can anyone adivce how i can disable the Title field on certain web parts using JSlink ?? as seems this part inside my JSLink is not working well:-

ctxForm.Templates.OnPreRender=function(ctx){var statusField = ctx.ListSchema.Field.filter(function(f){return f.Name==='Title';});if(statusField.length>0){
            statusField[0].AllowGridEditing=false;}}

Thanks

How I can disable a column inside the Quick Edit Grid using a JSLINK linked to my WebPart

$
0
0

I want to disable the Title column from the Quick Edit grid, inside certain web-parts so i did the following steps:-

1- I went to a list view.

2- Edit the page

3- Edit the web part.

4- Under the "Miscellaneous" tab

5- I add a reference to the following JSLink:-

(function () {

      function registerRenderer() {
        var ctxForm = {};
        ctxForm.Templates = ctxForm.Templates || {};;
        ctxForm.Templates.OnPreRender = function(ctx) {
        var statusField = ctx.ListSchema.Field.filter(function(f) {
            return f.Name === 'Title';
        });
        if (statusField.length>0) {
            statusField[0].AllowGridEditing = false;
        }
    }
        ctxForm.Templates = {
            Fields : {
                'LinkTitle': { //------ Change Hyperlink of LinkTitle
                    View : function (ctx) {
                        if(ctx.CurrentItem.SiteAutomaticallyCreated != null && ctx.CurrentItem.SiteAutomaticallyCreated === 'Yes'){
                        var url = String.format('{0}{1}', "/Programmes/", ctx.CurrentItem.ID);
                        return String.format('<a href="{0}" onclick="EditItem2(event, \'{0}\');return false;">{1}</a>', url, ctx.CurrentItem.Title);
                        }
                        else
                        {
                            var url = String.format('{0}{1}', "/Programmes/Lists/Projects/DispForm.aspx?ID=", ctx.CurrentItem.ID);
                        return String.format('<a href="{0}" onclick="EditItem2(event, \'{0}\');return false;">{1}</a>', url, ctx.CurrentItem.Title);
                        }
                    }
                },
            }
        };
        SPClientTemplates.TemplateManager.RegisterTemplateOverrides(ctxForm);
    }
    ExecuteOrDelayUntilScriptLoaded(registerRenderer, 'clienttemplates.js');


})();

But Title field will still be editable inside the quick edit grid, while the other part of my JS link (ctxForm.Templates) is working well. so can anyone adivce how i can disable the Title field on certain web parts using JSlink ?? as seems this part inside my JSLink is not working well:-

ctxForm.Templates.OnPreRender = function(ctx) {
        var statusField = ctx.ListSchema.Field.filter(function(f) {
            return f.Name === 'Title';
        });
        if (statusField.length>0) {
            statusField[0].AllowGridEditing = false;
        }
    }


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>