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

How to use compare dates in SharePoint 2013 REST search api?

$
0
0

I have a rest URL that uses Search API, for SP2013. I can use regular filters

    "/_api/search/query?querytext='contenttype:News Item'

like this says, get all items with content type is `news item`, but now I have a date type managed property, how can I set it so that I filter on if the date field is <= current date. Is there something like

    "/_api/search/query?querytext='articleDate le [today]'

I can replace [today] with an ISO converted string representation of the current date in javascript, so I just put that for simplicity.

But does anyone know how to compare dates in search rest query?

Thanks


Ways Export Storman.aspx in SharePoint Online

$
0
0

Dear All,

My client uses Online version of SharePoint. And I have access to the SharePoint UI or client side scripting. Mostly I am incharge of multiple site collection and I have site collection administration access unlike other users.

I would like to know if there is any way to export storman.aspx report using UI or client side scripting. I did some research and no service is available to access the storage management report using REST API or sp services.

Could any one help in this aspect?


JavaScript to open links in new tab - not working for all sites

$
0
0

In SharePoint Online, I created a few Pages within a site where I put Content Query Search Web Parts. On Other Pages, I have placed Content Query Tool Web Part. These web parts are retrieving documents from a Document Library.

I placed the following code in a Scripts Editor Web Part below the Content Query Search or Content Query Tool Web Part,

<script>
    $(document).ready(function(){
        $('ul > li > div.ja-doc-list > a').attr('target','_blank')   
});
</script>

For Content Query Search Web Part, I can see the displayed documents opening in a new tab when I click on a document. But for Content Query Tool Web Part, this logic does not work.

Not sure what is going on. Do I need to change anything in Web Part Properties?

Thanks a bunch!

Mayank

Custom Authentication Provider using Dynamics CRM

$
0
0

Hello!

I work for an organization that we use Dynamics CRM to manage all our membership data. I desperately want to have CRM be the authentication provider JUST for our members. (So I envision we mark someone as a member, then based on that, the email account becomes the username and they can manage their own passwords {resetting, etc.}) I know you can create a membership provider, but am wondering if anyone knows if this has been done that it is available for purchase? I hate to spend developer calories in building something that is already out there. Anyone know of any products like this? OR if not, any direction on how to achieve this? My time frame is tight and I need to solve this problem of membership management and access into specific areas of our SP2013 website.

Thanks Kindly,

Kathie

Can't use visio 2016 and sharpepoint designer 2013 together

$
0
0

I've office2016 with visio 2016 and sharepoint designer 2013. But it seems I'can only edit workflows if Visio2013 is installed. So Itried to install visio 2013. This however seems not possible unless I uninstall the hole office 2016 and downgrade to Office 2013.

Am I right that SPD2013 only cooperaties with visio 2013?

Am I right that Visio 2013 can not be installed together with other Office 2016 products?

If so, shame on Micorsoft!

 Why should I downgrade and miss the grate improvements of office 2016 just an only to be able to modify workflows in a grafical way?

 

Enterprise Search

$
0
0

Hi,

My customer has a SharePoint 2013 on-premise implementation in place. They have a number of intranet web based applications and network drives. The content size of all the documents in these sources would amount to at least 1 TB.
We know that technically SharePoint can crawl these content sources and provide us with search results.

I would like to know your opinion if its a wise decision to integrate SharePoint with external applications (through BCS) and build an information aggregation platform or is it practical to federate the search to external applications without configuring SharePoint to crawl these applications, build index  and give search results.

Also, SharePoint can crawl Lotus Notes mails but is it practical to implement that?

How successful is SharePoint on crawling mailboxes?

winform / C# .Net 4.5 and adfs

$
0
0
Hello,

   I'd like to find some help.

   The context:

   I need to read some data stored into a sharepoint (2013) list from inside my (C#) code which is a winform (using .Net 4.5).

   I've already done such thing quite easily. But this time the sharepoint I'd like to reach uses ADFS.

   I've found some explanations on the web but not for the purpose described just above.

   To be more clear I do not try to authenticate the user running the winform appli with adfs, but I try to connect to a sharepoint list using ADFS with credentials put in some config file, not necessarily the same as the current user running the winform application. 
   
   In other words I'd like to be able to connect through ADFS at any point of the code with differents credentials token from either a config file or event using credentials entered by a user through a popup form in my winform appli dynamically.

   Could anybody give me some resources (code?) or advices on this topic?

Kind regards.
Claude


                  

Error when looping through site collection to add content type to libraries

$
0
0

I am running the following code to add a content type to any library that already has a particular CT.  The CT I want to add is defined in the "clients" subsite and it is only doc libraries within this site that will have the "CT Looked For" CT already (because it is defined at this "clients" subsite as well).

#Get site object and
#specify name of the content type to look for in each library
$site = Get-SPSite (url)
$subsite = Get-SPWeb (url)/clients
$lookForCT = "CT Looked For"
$ctToAdd = $subsite.ContentTypes["CT to Add"]

#Walk through each site in the site collection
$site | Get-SPWeb -Limit all | ForEach-Object {
   
    write-host "Checking site:"$_.Title
   
    #Go through each document library in the site
    $_.Lists | where { $_.BaseTemplate -eq "DocumentLibrary" } | ForEach-Object {
       
        write-host "Checking list:"$_.Title
       
        #Check to see if the library contains the content type specified
        #at the start of the script
        if (($_.ContentTypes | where { $_.Name -eq $lookForCT }) -eq $null)
        {
            write-host "No content type exists with the name" $lookForCT "on list" $_.Title
        }
        else
        {
            #Add site content types to the list
            $ct = $_.ContentTypes.Add($ctToAdd)
            write-host "Content type" $ct.Name "added to list" $_.Title
            write-host "+++++++++++++++++++++++++++++"
            #$ctToAdd = $site.RootWeb.ContentTypes["IT Document"]
            #$ct = $_.ContentTypes.Add($ctToAdd)
            #write-host "Content type" $ct.Name "added to list" $_.Title
            #$_.Update()
        }
    }
}
#Dispose of the site object
$site.Dispose()

The code finds the first library and adds the "CT to Add" content type but then errors with:

An error occurred while enumerating through a collection: Collection was modified; enumeration operation may not
execute..

...

$_.Lists | where { $_.BaseTemplate -eq "DocumentLibrary" } | ForEach-Object  ...
+     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (Microsoft.Share...on+SPEnumerator:SPEnumerator) [], RuntimeExcepti
   on
    + FullyQualifiedErrorId : BadEnumeration

Any guidance would be appreciated.

Guidance on how to limit the loop to look only inside of the "clients" subsite would also be appreciated.

Thanks.



Notification Banner in SharePoint Online

$
0
0

Hi,

I am trying to add a compliance warning banner on both the page and the upload dialogue box on SharePoint Online and I can online seem to display them in one or the other!

This is what I am using

window.onload = function(){
    var bodytag = document.getElementsByTagName('body')[0];
    var div = document.createElement('div');
    div.setAttribute('id','banner');
    div.innerHTML = '<p style="background-color:yellow"><strong>Security Notice: Export Compliance -</strong></p>';

    bodytag.insertBefore(div,bodytag.firstChild); // Adds the Banner just after the opening <body> tag
    document.getElementsByTagName('body')[0].className+=' banner'; //Adds a class to the <body> tag when the banner is visible


}

Is there a better way to do this to ensure it displays everywhere and on the upload dialogue?

Any pointers would be great thanks in advance.

Create excel file from SharePoint list using timerjob - Error: The file format and extension of "filename.xls" don't match.

$
0
0

Hi,

I am trying to create an excel from SharePoint list using timer job.

The file is getting downloaded with the data, but when I try to open the file, I am getting an alert as "The file format and extension of "filename.xls" don't match. the file could be corrupted or unusage. unless you trust its source. don't open it. Do you want to open it anyway?"

If I click Yes, the file opens with all data from list. But I do not want the alert message.

I have used the below code.

 public override void Execute(Guid targetInstanceId)
        {
            string siteCollectionUrl = string.Empty;
                         SPWebApplication webApp = this.Parent as SPWebApplication;
                siteCollectionUrl = WebConfigurationManager.OpenWebConfiguration("/", webApp.Name).AppSettings.Settings["CustomListsURL"].Value;

  if (siteCollectionUrl != null && siteCollectionUrl.Trim() != string.Empty)
                {
 using (SPSite site = webApp.Sites[siteCollectionUrl])
                    {
                        using (SPWeb web = site.RootWeb)
                        {
                            this.DownloadLists(web);
                        }
                    }
                }
}


        private void DownloadLists(SPWeb web)
        {

string strListName = string.Empty;
            string strSiteURL = string.Empty;
            SPWebApplication webApp = this.Parent as SPWebApplication;

 tring strDirectory = Convert.ToString("directory path");

 DirectoryInfo dir = new DirectoryInfo(@strDirectory);
 dir.Create();

 string strFile = strDirectory + "\\" + "filename.xls");

createExcel(strSiteURL, strListName, strFile);
        }

public void createExcel(string strsiteURL, string strListName, string strFile)
        {
            DataTable dataTable = new DataTable();

            //Adds Columns to SpreadSheet
 using (SPSite site = new SPSite(strsiteURL))
            {
                using (SPWeb web = site.OpenWeb())
                {
                    SPList list = web.Lists[strListName.Trim()];
                    InitializeExcel(list, dataTable);

 string _schemaXML = list.DefaultView.ViewFields.SchemaXml;

                    if (list.Items != null && list.ItemCount > 0)
                    {
                        foreach (SPListItem _item in list.Items)
                        {
 DataRow dr = dataTable.NewRow();

foreach (DataColumn _column in dataTable.Columns)
                            {
                                if (dataTable.Columns[_column.ColumnName] != null && _item[_column.ColumnName] != null)
                                {
                                    dr[_column.ColumnName] = _item[_column.ColumnName].ToString();
                                }
                            }

                            dataTable.Rows.Add(dr);
                        }
                    }

  System.Web.UI.WebControls.DataGrid grid = new System.Web.UI.WebControls.DataGrid();

                    grid.HeaderStyle.Font.Bold = true;
                    grid.GridLines = GridLines.Both;

                    grid.DataSource = dataTable;

                    grid.DataBind();

using (StreamWriter streamWriter = new StreamWriter(strFile, false, Encoding.UTF8))
                    {
                        using (HtmlTextWriter htmlTextWriter = new HtmlTextWriter(streamWriter))
                        {
                            grid.RenderControl(htmlTextWriter);
                        }

                    }
}
}
}

public void InitializeExcel(SPList list, DataTable _datatable)
        {
                       if (list != null)
                {
                    string _schemaXML = list.DefaultView.ViewFields.SchemaXml;

                    if (list.Items != null && list.ItemCount > 0)
                    {
                        foreach (SPListItem _item in list.Items)
                        {
                            foreach (SPField _itemField in _item.Fields)
                            {
                                if (_schemaXML.Contains(_itemField.InternalName))
                                {
                                    if (_item[_itemField.InternalName] != null)
                                    {
                                        if (!_datatable.Columns.Contains(_itemField.InternalName))
                                        {
                                            _datatable.Columns.Add(new DataColumn(_itemField.StaticName, Type.GetType("System.String")));
                                        }
                                    }
                                }
                            }
                        }
                    }
                }

        }

I do not want the error alert. How to fix this? Is there anything in code to be changed?

Thanks


Followed Counts Webpart causing a problem.

$
0
0

Hello there,

Last month I started having an issue with the "Followed Counts" webpart from MySites which I imported into a web page on the default SharePoint collection, since I applied the August 2015 CU for SharePoint.

https://domain/pages/newsfeed.aspx

I am currently getting this error:

The "FollowedCountsWebPart" Web Part appears to be causing a problem. Object reference not set to an instance of an object.

Web Parts Maintenance Page: If you have permission, you can use this page to temporarily close Web Parts or remove personal settings. For more information, contact your site administrator.

What I have already done:

1. Delete the webpart from the page and export the webpart from MySites and re-import, then add the webpart again. No change to the error.

2. Install SharePoint updates for September 2015.

3. Put in place a script that queries my follows and displays information, this is currently my workaround but it doesn't provide the ability to manage the different categories (People, Documents, Sites and Tags)

Why am I doing this? I work at a school and we are trying to limit the ability to manage MySites, so we have done a redirect on the MySites home page to force students to another landing page.

I would be really grateful if someone could help me troubleshoot this problem.

Best regards,

Gunter


SharePoint 2013 - People Search - Custom Profile Page instead of My Site

$
0
0

Hello -  Is it possible to set the custom page when user click on the Person on the People Search result? By default it takes to the mysite. Default MySite is so ugly and doesn't give lots of details. We don't want to customize mySite and apply branding because we are not going to use other features of mySite viz. Newsfeed, blogs, etc. Also, we need extra user properties viz. previous employers etc. to show on the profile page.

We just need to show User's profile. 

Any suggestions please?


Khushi


SharePoint ULS: How can I manage the logs written to the ULS by workflow manager?

$
0
0

Hi,

I have workflow manager 2013 installed in our sharepoint farm but it writes too many logs into the ULS mostly of medium level.
Once I start a workflow with a loop, the log file starts to grow astronomically
Does anyone know how i can manage the log levels in ULS caused by running a workflow on 2013 workflow platform type?

Kind Regards

Louis


<o:p></o:p>


thanks

Import Data Into Resource Field Type?

$
0
0

Hey SharePoint Fam,

I have a weird issue where I have around 900 items I need to import via Powershell into Resource Booking List where the actual resources are stored in a column named "Resources" and the type is showing as resource for column type.  I am able to import all fields except the Resources column, was wondering if anyone knows the format needed to import data into a Resources type column.  One of the options is "Main Campus Conference Room" and I have tried 3 different options that I thought may work but no luck.  I get error message "Invalid Data has been used to update the list item" after using following data

1) Main Campus Conference Room

2)

<a onclick="OpenPopUpPage('http://domain/ms/_layouts/15/listform.aspx?PageType=4&ListId={65F15651-E794-4D00-B8E8-23BE298D406D}&ID=6&RootFolder=*', RefreshPage); return false;" href="http://domain/ms/_layouts/15/listform.aspx?PageType=4&ListId={65F15651-E794-4D00-B8E8-23BE298D406D}&ID=6&RootFolder=*">Main Campus Conference Room</a>

3) 1;#Main Campus Conference Room

How to get the version number of a SharePoint hosted App instance using JavaScript?

$
0
0

Hi,

Is there a way to find out the version of an App instance using SP JavaScript library? The App is SharePoint Hosted and has been deployed to the current site.

I have an aspx page which will be deployed to SharePoint online. On the page, I'd like to add some logic to check if a certain App instance exists at the site level, and display different message based on its version. I am able to use SP.Web.getAppInstancesByProductId() to get the instance but it has all information (title, url, Id, etc.) except the app version number. 

Thanks,

Matt.



How do I get the "Start a Task Process" to work on a SharePoint 2013 workflow?

$
0
0

I am building a SharePoint 2013 approval workflow and I want the end user to be able to determine who the approvers should be when they initiate the workflow. Right now, I have a column on my list called "Approvers" that holds people or Group data. This column is also created to take in multiple entries. I have now created a SharePoint 2013 Designer workflow, and done the following

- Added a log to help me identify how the workflow is progressing
- Started a task process. Set the Participants on the task Process to "Current Item: Approvers". 
- Added another log to help me identify how the workflow is progressing

...when I run the workflow, I get both logs returned to the history, but no email notifications (tasks) are sent out to the participants. To play devil's advocate, I tried the same thing with a SharePoint 2010 workflow and the task notification do go out. Did something change from 2010 to 2013, that is making the "Start a Task Process" action not function as I am attempting to use it? Is there a new way to use this? Please help...and I appreciate all the help and ideas.

In LVWP - When someone clicks on Item Titles - dropdown the description (Instead of taking the user to the ViewItem.aspx page - How to do this?

$
0
0

Hi there

In LVWP - When someone clicks on Item Titles - they go to item details page.
Instead we need to show the Item Description right there (when user clicks on item title)

Any way to do this? JavaScript? XSLT?

(Sometimes websites show FAQs in this way - you click on a question and the answer is show right there).

Thanks.

Logical operators are not working in JS file

$
0
0

Dear All,

            Everything is fine  I am able to fetching the data from SharePoint 2013 List using CAML query in my js file.

But when i try to get the data via dropdown conditions my code is executing in the else statement .Can aone help me what went wrong in my below code

alert('entered into SVV function');
var clientContext = new SP.ClientContext.get_current();
/*alert('Go Client Context');*/
var oList = clientContext.get_web().get_lists().getByTitle('Execution');
var drbregionvalue= document.getElementById("drbregion").value;
var drbfunctionsvalue= document.getElementById("drbfunctions").value;
var drbmonthvalue=document.getElementById("drbmonth").value;
var allvalue="ALL";

var camlQuery = new SP.CamlQuery();

if(drbfunctionsvalue!=allvalue && drbregionvalue!=allvalue)
{
alert('Your dropdown values for both are all');
camlQuery.set_viewXml("<View><Query><Where><And><Eq><FieldRef Name='Region'/><Value Type='Text'>" + drbregionvalue + "</Value></Eq><Eq><FieldRef Name='Title'/><Value Type='Text'>" + drbfunctionsvalue + "</Value></Eq></And></Where></Query></View>");
}
else
{
alert('Among 1 Dropdowns You selected all');

}


Sharepoint Portal root site collection which is proper way ? Team site or Publishing site?

$
0
0

Hi,

I have  doubt ,in share point portal,which is proper/correct way to creating team site or publishing site for root site collection ?if you have idea or suggestion always welcome.


Custom Timer Job not updated

$
0
0

I created a custom timer job with scope = WebApplication. Since this is new to me, I added test code to output dummy data to list item at beginning. It seems working fine. Then I wrote real code to the Execute() function and re-deploy it. However, it looks like the old code is still executed that out put the dummy data. It does not matter that I redeploy job many times. I even deleted then recreate the job. The result is the same. 

Please advise what I missed. Many thanks.

Viewing all 7589 articles
Browse latest View live


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