Export Mail to pst between date range with Messagekind eq Email

Exchange 14.2 247.5
I am trying to export all mail from a piped list of mailboxes but only between two dates. I can do one or the other, but not combine both contentfilters - can anyone offer any advice as to what I'm doing wrong? I've played with different combinations of
brackets but I can't get it do do an -and for some reason. My spreadsheet has columns for alias and pstpath - this part is fine, I just can't get it to evaulate both contentfilters. My short script:
foreach ($i in (Import-Csv c:\temp\export\mailtest.csv)) { 
New-MailboxExportRequest -Mailbox $i.Alias -FilePath $i.PSTpath -ContentFilter {(Received -lt '07/18/2014') -and (Received -gt '06/18/2014')} {MessageKind -eq Email}
I'm also running a script to shift all calendars and contacts (not date limited) to pst but am running this seperately. If these can be combined then great, but I'm happy to run two commands.
THanks
James.

No joy still with that either. Running Get-MailboxExportRequestStatistics -Identity MaibloxName\MailboxExport
-IncludeReport | Format-List gives the error message:
AssociatedMessagesCopyOption  : DoNotCopy
BatchName                     :
ContentFilter                 : ((((Received -lt '18/07/2014 12:00:00 AM') -and (Received -gt '18/06/2014 12:00:00 AM')
                                )) -and (MessageKind -eq 'Email'))
ContentFilterLanguage         :
BadItemLimit                  : 0
BadItemsEncountered           : 0
QueuedTimestamp               : 19/07/2014 3:18:11 PM
StartTimestamp                :
LastUpdateTimestamp           : 19/07/2014 3:18:15 PM
CompletionTimestamp           :
SuspendedTimestamp            :
OverallDuration               : 00:00:15
TotalSuspendedDuration        :
TotalFailedDuration           : 00:00:12
TotalQueuedDuration           : 00:00:03
TotalInProgressDuration       : 00:00:00
TotalStalledDueToHADuration   :
TotalTransientFailureDuration :
MRSServerName                 :
EstimatedTransferSize         : 0 B (0 bytes)
EstimatedTransferItemCount    : 0
BytesTransferred              : 0 B (0 bytes)
BytesTransferredPerMinute     :
ItemsTransferred              : 0
PercentComplete               : 0
PositionInQueue               :
FailureCode                   : -2146233088
FailureType                   : InvalidContentFilterPermanentException
FailureSide                   :
Message                       : Error: ContentFilter is invalid. The value "18/07/2014 12:00:00 AM" could not be conver
                                ted to type System.DateTime. --> The value "18/07/2014 12:00:00 AM" could not be conver
                                ted to type System.DateTime.
FailureTimestamp              : 19/07/2014 3:18:15 PM
FailureContext                :
I am in AU using English (australia) and so using dd/mm/yyyy short date format but understand that this is irrelevant and we use mm/dd/yyyy for powershell operations. 
The command I am using is:
New-MailboxExportRequest -Mailbox $i.Alias -FilePath $i.PSTpath -ContentFilter {((Received -lt '07/18/2014') -and (Received -gt '06/18/2014') -and (MessageKind -eq "Email"))}
I don't understand why this is failing...

Similar Messages

  • Data between Date Range with Business Days only

    Hi All,
    We have a requirement that we need to retrieve data between a data range, providing From date and To date as input.
    We also have the option to Include Business Days Only through a check box which will be passed to CR 2008 through a report frame work.
    Can some one help me how to display the report data within the Date Range entered and that includes only Business Days.
    Thanks in advance for the help.
    Regards,
    Naresh.

    try this formula. Lets if your date range parameter is {?date} then try this formula
    @startdate:
    if datepart('w',minimum({?date}))=7 then
    minimum({?date})+2
    else if datepart('w',minimum({?date}))=1 then
    minimum({?date})+1
    else
    minimum({?date})
    @enddate
    if datepart('w',maximum({?date}))=7 then
    maximum({?date})+2
    else if datepart('w',maximum({?date}))=1 then
    maximum({?date})+1
    else
    maximum({?date})
    regards,
    Raghavendra

  • How to count the days between Date Range using OO ABAP?

    hi experts,
            i want to count the days between Date Range using OO ABAP for that  which class and method  can i use?.
    Thanks,
    Mahesh.

    Not sure I understand the requirement for it to be OO, but you could always write your own (i.e. use this):
    REPORT zz_date_diff.
    CLASS date_diff DEFINITION.
      PUBLIC SECTION.
        METHODS diff IMPORTING     i_date_fm TYPE d
                                   i_date_to TYPE d
                     EXPORTING     e_days    TYPE i.
    ENDCLASS."
    CLASS date_diff IMPLEMENTATION.
      METHOD diff.
        e_days = i_date_to - i_date_fm.
      ENDMETHOD."
    ENDCLASS."
    DATA: g_ref TYPE REF TO date_diff,
          g_days  TYPE i,
          g_date_fm  TYPE d VALUE '20080101',
          g_date_to  TYPE d VALUE '20090101'.
    START-OF-SELECTION.
      CREATE OBJECT g_ref.
      CALL METHOD g_ref->diff
        EXPORTING
          i_date_fm = g_date_fm
          i_date_to = g_date_to
        IMPORTING
          e_days    = g_days.
      WRITE g_days.

  • Need help to join two tables using three joins, one of which is a (between) date range.

    I am trying to develop a query in MS Access 2010 to join two tables using three joins, one of which is a (between) date range. The tables are contained in Access. The reason
    the tables are contained in access because they are imported from different ODBC warehouses and the data is formatted for uniformity. I believe this cannot be developed using MS Visual Query Designer. I think writing a query in SQL would be suiting this project.
    ABCPART links to XYZPART. ABCSERIAL links to XYZSERIAL. ABCDATE links to (between) XYZDATE1 and ZYZDATE2.
    [ABCTABLE]
    ABCORDER
    ABCPART
    ABCSERIAL
    ABCDATE
    [ZYXTABLE]
    XYZORDER
    XYZPART
    XYZSERIAL
    XYZDATE1
    XYZDATE2

    Thank you for the looking at the post. The actual table names are rather ambiguous. I renamed them so it would make more sense. I will explain more and give the actual names. What I do not have is the actual data in the table. That is something I don't have
    on this computer. There are no "Null" fields in either of the tables. 
    This table has many orders (MSORDER) that need to match one order (GLORDER) in GLORDR. This is based on MSPART joined to GLPART, MSSERIAL joined to GLSERIAL, and MSOPNDATE joined if it falls between GLSTARTDATE and GLENDDATE.
    [MSORDR]
    MSORDER
    MSPART
    MSSERIAL
    MSOPNDATE
    11111111
    4444444
    55555
    2/4/2015
    22222222
    6666666
    11111
    1/6/2015
    33333333
    6666666
    11111
    3/5/2015
    This table has one order for every part number and every serial number.
    [GLORDR]
    GLORDER
    GLPART
    GLSERIAL
    GLSTARTDATE
    GLENDDATE
    ABC11111
    444444
    55555
    1/2/2015
    4/4/2015
    ABC22222
    666666
    11111
    1/5/2015
    4/10/2015
    AAA11111
    555555
    22222
    3/2/2015
    4/10/2015
    Post Query table
    GLORDER
    MSORDER
    GLSTARTDATE
    GLENDDATE
    MSOPNDATE
    ABC11111
    11111111
    1/2/2015
    4/4/2015
    2/4/2015
    ABC22222
    22222222
    1/5/2015
    4/10/2015
    1/6/2015
    ABC22222
    33333333
    1/5/2015
    4/10/2015
    3/5/2015
    This is the SQL minus the between date join.
    SELECT GLORDR.GLORDER, MSORDR.MSORDER, GLORDR.GLSTARTDATE, GLORDR.GLENDDATE, MSORDR.MSOPNDATE
    FROM GLORDR INNER JOIN MSORDR ON (GLORDR.GLSERIAL = MSORDR.MSSERIAL) AND (GLORDR.GLPART = MSORDR.MSPART);

  • Saturday's between date range

    Hi All,
                I need to findout the number of satuday's between the given date range.
    Please tell me if there are any function modules or methods to calculate this.
    Regards
    Suprith

    Hi Suprith,
    Please refer the below Code.
    CALL FUNCTION 'DAY_ATTRIBUTES_GET'
    EXPORTING
    *   FACTORY_CALENDAR                 = ' '
    *   HOLIDAY_CALENDAR                 = ' '
       DATE_FROM                        = From_Date
       DATE_TO                          = To_Date
       LANGUAGE                         = SY-LANGU
    *   NON_ISO                          = ' '
    * IMPORTING
    *   YEAR_OF_VALID_FROM               =
    *   YEAR_OF_VALID_TO                 =
    *   RETURNCODE                       =
      TABLES
        day_attributes                   = it_day_attri
    * EXCEPTIONS
    *   FACTORY_CALENDAR_NOT_FOUND       = 1
    *   HOLIDAY_CALENDAR_NOT_FOUND       = 2
    *   DATE_HAS_INVALID_FORMAT          = 3
    *   DATE_INCONSISTENCY               = 4
    *   OTHERS                           = 5
    IF sy-subrc <> 0.
    * MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    *         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    in the Export internal table it_day_attri  you will get all the dates and its respective days. if you delete the records other than Saturday , the number of entries will be needed count of saturday.
    delete it_day_attri where WEEKDAY  <> '6'.
    DESCRIBE TABLE it_day_attri LINES Count.
    note  :  weekday day number ( Saturday = 6 may vary based on factory calendar )
    Edited by: Prasath Arivazhagan on Apr 8, 2010 1:07 PM

  • Using analytical function to calculate concurrency between date range

    Folks,
    I'm trying to use analytical functions to come up with a query that gives me the
    concurrency of jobs executing between a date range.
    For example:
    JOB100 - started at 9AM - stopped at 11AM
    JOB200 - started at 10AM - stopped at 3PM
    JOB300 - started at 12PM - stopped at 2PM
    The query would tell me that JOB1 ran with a concurrency of 2 because JOB1 and JOB2
    were running started and finished within the same time. JOB2 ran with the concurrency
    of 3 because all jobs ran within its start and stop time. The output would look like this.
    JOB START STOP CONCURRENCY
    === ==== ==== =========
    100 9AM 11AM 2
    200 10AM 3PM 3
    300 12PM 2PM 2
    I've been looking at this post, and this one if very similar...
    Analytic functions using window date range
    Here is the sample data..
    CREATE TABLE TEST_JOB
    ( jobid NUMBER,
    created_time DATE,
    start_time DATE,
    stop_time DATE
    insert into TEST_JOB values (100, sysdate -1, to_date('05/04/08 09:00:00','MM/DD/YY hh24:mi:ss'), to_date('05/04/08 11:00:00','MM/DD/YY hh24:mi:ss'));
    insert into TEST_JOB values (200, sysdate -1, to_date('05/04/08 10:00:00','MM/DD/YY hh24:mi:ss'), to_date('05/04/08 13:00:00','MM/DD/YY hh24:mi:ss'));
    insert into TEST_JOB values (300, sysdate -1, to_date('05/04/08 12:00:00','MM/DD/YY hh24:mi:ss'), to_date('05/04/08 14:00:00','MM/DD/YY hh24:mi:ss'));
    select * from test_job;
    JOBID|CREATED_TIME |START_TIME |STOP_TIME
    ----------|--------------|--------------|--------------
    100|05/04/08 09:28|05/04/08 09:00|05/04/08 11:00
    200|05/04/08 09:28|05/04/08 10:00|05/04/08 13:00
    300|05/04/08 09:28|05/04/08 12:00|05/04/08 14:00
    Any help with this query would be greatly appreciated.
    thanks.
    -peter

    after some checking the model rule wasn't working exactly as expected.
    I believe it's working right now. I'm posting a self-contained example for completeness sake.I use 2 functions to convert back and forth between epoch unix timestamps, so
    I'll post them here as well.
    Like I said I think this works okay, but any feedback is always appreciated.
    -peter
    CREATE OR REPLACE FUNCTION date_to_epoch(p_dateval IN DATE)
    RETURN NUMBER
    AS
    BEGIN
    return (p_dateval - to_date('01/01/1970','MM/DD/YYYY')) * (24 * 3600);
    END;
    CREATE OR REPLACE FUNCTION epoch_to_date (p_epochval IN NUMBER DEFAULT 0)
    RETURN DATE
    AS
    BEGIN
    return to_date('01/01/1970','MM/DD/YYYY') + (( p_epochval) / (24 * 3600));
    END;
    DROP TABLE TEST_MODEL3 purge;
    CREATE TABLE TEST_MODEL3
    ( jobid NUMBER,
    start_time NUMBER,
    end_time NUMBER);
    insert into TEST_MODEL3
    VALUES (300,date_to_epoch(to_date('05/07/2008 10:00','MM/DD/YYYY hh24:mi')),
    date_to_epoch(to_date('05/07/2008 19:00','MM/DD/YYYY hh24:mi')));
    insert into TEST_MODEL3
    VALUES (200,date_to_epoch(to_date('05/07/2008 09:00','MM/DD/YYYY hh24:mi')),
    date_to_epoch(to_date('05/07/2008 12:00','MM/DD/YYYY hh24:mi')));
    insert into TEST_MODEL3
    VALUES (400,date_to_epoch(to_date('05/07/2008 10:00','MM/DD/YYYY hh24:mi')),
    date_to_epoch(to_date('05/07/2008 14:00','MM/DD/YYYY hh24:mi')));
    insert into TEST_MODEL3
    VALUES (500,date_to_epoch(to_date('05/07/2008 11:00','MM/DD/YYYY hh24:mi')),
    date_to_epoch(to_date('05/07/2008 16:00','MM/DD/YYYY hh24:mi')));
    insert into TEST_MODEL3
    VALUES (600,date_to_epoch(to_date('05/07/2008 15:00','MM/DD/YYYY hh24:mi')),
    date_to_epoch(to_date('05/07/2008 22:00','MM/DD/YYYY hh24:mi')));
    insert into TEST_MODEL3
    VALUES (100,date_to_epoch(to_date('05/07/2008 09:00','MM/DD/YYYY hh24:mi')),
    date_to_epoch(to_date('05/07/2008 23:00','MM/DD/YYYY hh24:mi')));
    commit;
    SELECT jobid,
    epoch_to_date(start_time)start_time,
    epoch_to_date(end_time)end_time,
    n concurrency
    FROM TEST_MODEL3
    MODEL
    DIMENSION BY (start_time,end_time)
    MEASURES (jobid,0 n)
    (n[any,any]=
    count(*)[start_time<= cv(start_time),end_time>=cv(start_time)]+
    count(*)[start_time > cv(start_time) and start_time <= cv(end_time), end_time >= cv(start_time)]
    ORDER BY start_time;
    The results look like this:
    JOBID|START_TIME|END_TIME |CONCURRENCY
    ----------|---------------|--------------|-------------------
    100|05/07/08 09:00|05/07/08 23:00| 6
    200|05/07/08 09:00|05/07/08 12:00| 5
    300|05/07/08 10:00|05/07/08 19:00| 6
    400|05/07/08 10:00|05/07/08 14:00| 5
    500|05/07/08 11:00|05/07/08 16:00| 6
    600|05/07/08 15:00|05/07/08 22:00| 4

  • Group by week between date range

    Hi,
    i'm having a table for documents. The documents are received from diffeent dates. I've to calculate number of documents received on weekly basis.
    I need an sql to count the number of documents between two given dates grouping by weekly.
    My week starts on Sunday and ends with Saturday.
    I've tried group by with to_char(documentdate,'IW') , but this will take Monday to Sunday as a week & the incomlete weeks i'm not able to calculate. ie : in the below output the date range 1/28/2007 - 1/31/2007 is not a complete week . ( ie saturday to wednesday)
    I need out put should be like this for Date Range: 12/31/2006 to 1/31/2007
    week               count of documents
    12/31/2006 - 1/6/2007 10
    1/7/2007 - 1/13/2007     40
    1/14/2007 - 1/20/2007     30
    1/21/2007 - 1/27/2007     20
    1/28/2007 - 1/31/2007 10
    Please help me to get this.....
    (columns in documents table is documentid and documentdate)

    your're very close with IW. you just need to shift the data to get it to fall within the correct range. btw, you don't need julian dates. it's overkill
    trunc(date+1,'IW') will push the date into the correct week range (IW will put sunday one week earlier than you want, so push it ahead a day before truncating).
    then subtract 1 day from the result to get it to display with sunday's date instead of monday
    trunc(mydate+1, 'IW')-1
    and the week end date is simply trunc(mydate+1, 'IW')_5
    select mydate, to_char(mydate,'Dy') dy,
    trunc(mydate+1,'IW')-1 wk_Start,
    trunc(mydate+1,'IW')+5 wk_end
    from (select sysdate-rownum mydate from dual connect by level < 20)
    order by 1

  • List in between date range

    i'm having data stored as follows
    DEPOT_CODE EMP_ID ACTIVE_FROM ACTIVE_TO
    400 68955 01-JAN-08 31-JAN-09
    400 68962 01-JAN-08 20-JAN-08
    400 68999 01-JAN-08
    400 689600 01-JAN-08
    400 684530 01-JAN-08
    I wanted to list all the records active in between given date range even though active_to is null
    i.e if i give 10/01/2008 to 02/02/2008
    i want to display all the records which is shown in above
    Thanking you

    Lakmal, I wouldn't take advise from Bhaskar on this one, as he clearly does
    not know how to work with dates, and also does not grasp the concept of a
    date range.
    You have a range, and you want to check if it covers (in whole or in part)
    the from-to period, right?
    I changed the data to include a row (first one) not to be output.
    with dummy as (
    select 400 depot_code, 68955 emp_id, to_date('01-JAN-08', 'DD-MON-YY') active_from, 
        to_date('05-JAN-08', 'DD-MON-YY') active_to from dual union all
    select 400 depot_code, 68955 emp_id, to_date('01-JAN-08', 'DD-MON-YY') active_from, 
        null active_to from dual union all 
    select 400 depot_code, 68955 emp_id, to_date('01-JAN-08', 'DD-MON-YY') active_from, 
        to_date('31-JAN-09', 'DD-MON-YY') active_to from dual union all
    select 400 depot_code, 68962 emp_id, to_date('01-JAN-08', 'DD-MON-YY') active_from, 
        to_date('20-JAN-08', 'DD-MON-YY') active_to from dual union all
    select 400 depot_code, 68999 emp_id, to_date('01-JAN-08', 'DD-MON-YY') active_from, 
        null active_to from dual
    select *
    from dummy
    DEPOT_CODE     EMP_ID ACTIVE_FR ACTIVE_TO
           400      68955 01-JAN-08 05-JAN-08
           400      68955 01-JAN-08         
           400      68955 01-JAN-08 31-JAN-09
           400      68962 01-JAN-08 20-JAN-08
           400      68999 01-JAN-08         
    5 rows selected.
    SELECT *
      FROM dummy
    WHERE NVL (active_to, TO_DATE ('10-JAN-08', 'DD-MON-YY')) >=
                   TO_DATE ('10-JAN-08', 'DD-MON-YY')
                   AND active_from <= to_date('02-FEB-08', 'DD-MON-YY')
    DEPOT_CODE     EMP_ID ACTIVE_FR ACTIVE_TO
           400      68955 01-JAN-08         
           400      68955 01-JAN-08 31-JAN-09
           400      68962 01-JAN-08 20-JAN-08
           400      68999 01-JAN-08         
    4 rows selected.given that active_from is never null.
    Isn't it as simple as this? The active_to must be after your start_date,
    and the active_from must be before the end....

  • Display all dates between date range (Time Dimension left outer join Fact)

    All,
    I have done some searching around this issue but within all the posts regarding date variables, date prompts and date filtering I haven't seen one exactly answering my issue (maybe they are and I just dont have my head around it correctly yet).
    My report requirement is to allow a user to select a start day and an end day. The report should show all activity between those two days - AND display 0/null on days where there is no activity. That second part is where I am getting hung up.
    The tables in question are:
    TimeDim
    EventFact
    CustomerDim
    My BMM is setup as follows:
    TimeDim left outer join EventFact
    CustomerDim inner join EventFact
    If I run a report selecting DAY from TimeDim and a measure1 from EventFact with day range 1/1/2010 - 12/31/2010 .. I get a record for every day and it looks perfect because of the left outer join between TimeDim and CustomerDim.
    But .. if I add in a field from CustomerDim, select TimeDim.DAY, CustomerDim.CUSTNAME, EventFact.MEASURE1, OBIEE only returns records for the days that have EventFact records.
    This is due to the fact that the TimeDim is still outer joined into EventFact but adding in CustomerDim makes OBIEE setup an inner join between those tables which then causes only data to be returned where EventFact data exists.
    There is a way around this in this simple case and that is to define the relationship between CustomerDim and EventFact as an outer join as well. This will give the desired effect (but an outer join between these two tables is not the true relationship) and as I add additional dimensions and add additional logical sources to a single dimension in the BMM it gets complicated and messy.
    Ive also messed with setting the driving table in the relationship, etc.. but it has not given the desired effect.
    Has anyone ever encountered the need to force display all dates within a specfied range with a fact table that may not have an entry for every date?
    Thanks in advance.
    K
    Edited by: user_K on Apr 27, 2010 11:32 AM

    It worked!!!* Even my time drill downs and date based filtering still work!
    That is awesome. Never would have thought of that intuitively.
    Now, just need a little help understanding how it works. When I run my report and check the logs I can see that two queries are issued:
    Query 1: Joins the fact table to all the associated dimensions. I even changed all the relationships to inner joins (which is what they truly are). And calculates the original measure. If I copy and paste this query into sql developer it runs fine but only returns those rows that joined to the time dimension - which is what was happening before. It is correct but I wanted a record for every time dimension record.
    Query 2: Looks like the following:
    select sum(0)
    from timedim
    where date between <dateprompt1> and <dateprompt2>
    group by month *<--* this is the time dimension level specified in Query 1, so it knows to aggregate to the month level as was done in query 1
    Final Question: So what is OBIEE doing ultimately, does it issue these two requests and then perform a full outer join or something to bring them together? I couldn't see anywhere in the log a complete query that I could just run to see a similar result that I was getting in Answers.
    Thanks for all the help .. Id give more points if I could.
    K

  • Date Ranges with EOMONTH

    Hi I'm look
    for a date ranges query, any help would be greatly appreciated<o:p></o:p>
    Ie
    01/06/2014 to 30/06/2014<o:p></o:p>
    SELECT
    count(DISTINCT[Form Number]) as OutofFunding
    FROM [dbo].[NEWVIEW]
    WHERE [Cohort Desc] IN ('Apprenticeships')
    AND [Expected End] > EOMONTH(GETDATE(), -1) <o:p></o:p>

    Here is how you can do datetime range with EOMONTH:
    SELECT Count(DISTINCT[form number]) AS OutofFunding
    FROM [dbo].[newview]
    WHERE [cohort desc] IN ( 'Apprenticeships' )
    AND [expected end] > Eomonth(Getdate(), -1)
    AND [expected end] < Dateadd(dd, 1, Eomonth(Getdate(), 4));
    BLOG on datetime ranges:
    http://www.sqlusa.com/bestpractices2008/between-dates/
    Kalman Toth Database & OLAP Architect
    SQL Server 2014 Design & Programming
    New Book / Kindle: Exam 70-461 Bootcamp: Querying Microsoft SQL Server 2012

  • Need JavaScript for Sharepoint Designer 2010, to show a Pop-up to all the users between date range and the redirect the site

    Dear all,
    I am very new to Sharepoint designer 2010. Its better to say, i am just stepping in.
    I have sharepoint site which is accessible for all the users to update few information. But i want this site not to be accessible during a date range, say from 15th to 20th of every month.
    I am planning to have something like this: If any user tries to access this sharepoint site between 15th to 20th date range of everymonth, then the browser must show an pop-up alert saying "This site is not accessible during this date range" and Redirect
    this sharepoint site to someother site (Say http:// somesitename.xx.com) immidiately.
    I know very little about how to add Javascript in sharepoint webpart.
    Please provide the Javascript or any best alternate solution to my concern.
    Thanks in advance.

    Hi,
    From your description, my understanding is that you want to redirect sharepoint site to another site between 15th and 20th every month.
    I agree with what Sudip says. If you still want to use JS code,You could try these steps
    below:
    Open your site with SharePoint Designer.
    Click Master Pages in left navigation.
    Find file v4.master, and backup it(it is very important).
    Right click your v4.master,
    choose "Edit File in Adavance Mode".
    Add the code below into the <head/> tag.
    <script src="https://code.jquery.com/jquery-1.11.1.min.js" type="text/javascript"></script><script
    type="text/javascript">
    $(document).ready(function(){
    var today = new Date();  
    var day = today.getDate(); // get current day
    var id = _spPageContextInfo.userid; // get the id of current logon in user
    var boolFlg = false;
    $.ajax({
       url: _spPageContextInfo.webAbsoluteUrl + "/_api/web/SiteGroups/GetByName(\'"+"sharepoint Owners"+"\')/Users", //get users in a specified group can access the sharepoint site from 15th to 20th every
    month
       type: "GET",
       headers: {"accept": "application/json;odata=verbose"},
       success: function (data) {
          if (data.d.results) { 
             var src = data.d.results;
             for(var i = 0; i < src.length; i++){
                if(src[i].userid==id){ //check the logon in user in  the specified group or not
                   boolFlg = false;
                   break;
             if(!boolFlg){
                if(day <= 20 && day >=15){
                    alert("This site is not accessible during this date range"); // alert the message
                    location.href = "http:// somesitename.xx.com"; // redirect to another site
       error: function (xhr) {
          alert(xhr.status + ': ' + xhr.statusText);
    })</script>
    Best Regards
    Vincent Han
    TechNet Community Support

  • Date ranges with OLE DB

    Post Author: georgeb
    CA Forum: Data Connectivity and SQL
    Does anyone know if the issue with date ranges in OLE DB reports using Visual Foxpro databases has been resolved in Crystal Reports 10?
    Currently all OLE DB reports that use date ranges crash with:
    Failed to open a rowset.Details: ADO Error Code: 0x80004005Source: Microsoft OLE DB Provider for Visual FoxProDescription: SQL: Column 'DATETIME' is not foundNative Error: 806We referred this to Business Objects some time ago and their comment was that they do not supportVisual FoxPro ...
    Any assistance would be appreciated.

    Here is how you can do datetime range with EOMONTH:
    SELECT Count(DISTINCT[form number]) AS OutofFunding
    FROM [dbo].[newview]
    WHERE [cohort desc] IN ( 'Apprenticeships' )
    AND [expected end] > Eomonth(Getdate(), -1)
    AND [expected end] < Dateadd(dd, 1, Eomonth(Getdate(), 4));
    BLOG on datetime ranges:
    http://www.sqlusa.com/bestpractices2008/between-dates/
    Kalman Toth Database & OLAP Architect
    SQL Server 2014 Design & Programming
    New Book / Kindle: Exam 70-461 Bootcamp: Querying Microsoft SQL Server 2012

  • Compute Date Range with SQL Statement

    I'm sure there is a way to do this in SQL, but I cannot figure it out. I can write a PL/SQL script to do it, but would prefer using a SQL Statement. My database is Oracle Database 10.2.0.4.0.
    I have a table that contains information such as the employee number, department id, and the effective date of when the person started in that department. There is data in another table that I want to update their department number in based on their effective date range. If I could figure out how to select the effective date range correctly, I can do the rest.
    I have data such as:
    EMP_ID DEPT_NO EFFECTIVE
    101 1000 1/15/2001
    101 1050 5/24/2005
    101 2010 6/8/2008
    101 1000 8/2/2010
    I want to write a SELECT statement that returns something like this where the END_DATE is the day before the EFFECTIVE date and the last record does not have an END_DATE because they are still assigned to that department. Also, the first record in the column, I don't want to select a DEPT_NO because the effective date logic was added in January 2001 so if a person started back in 1985 they could have switched departments zero to many times so I'm not going to update any data for that period:
    EMP_ID DEPT_NO EFFECTIVE END_DATE
    101 1/14/2001
    101 1000 1/15/2001 5/23/2005
    101 1050 5/24/2005 6/7/2008
    101 2010 6/8/2008 8/1/2010
    101 1000 8/2/2010
    Below is a script to create the data in a temp table that can be used to write a SELECT statement on. I have added two employee records with different dates.
    create table temp_activity
    (emp_id number(12),
    dept_no number(12),
    effective date);
    INSERT INTO temp_activity
    (EMP_ID,DEPT_NO,EFFECTIVE)
    VALUES
    (101,1000,to_date('1/15/2001','MM/DD/YYYY'))
    INSERT INTO temp_activity
    (EMP_ID,DEPT_NO,EFFECTIVE)
    VALUES
    (101,1050,to_date('5/24/2005','MM/DD/YYYY'))
    INSERT INTO temp_activity
    (EMP_ID,DEPT_NO,EFFECTIVE)
    VALUES
    (101,2010,to_date('6/8/2008','MM/DD/YYYY'))
    INSERT INTO temp_activity
    (EMP_ID,DEPT_NO,EFFECTIVE)
    VALUES
    (101,1000,to_date('8/2/2010','MM/DD/YYYY'))
    INSERT INTO temp_activity
    (EMP_ID,DEPT_NO,EFFECTIVE)
    VALUES
    (102,1040,to_date('1/15/2001','MM/DD/YYYY'))
    INSERT INTO temp_activity
    (EMP_ID,DEPT_NO,EFFECTIVE)
    VALUES
    (102,2000,to_date('6/16/2006','MM/DD/YYYY'))
    Any help is appreciated. This is probably easy, but I cannot get my brain wrapped around it.
    Thanks - mike

    select  emp_id,
            dept_no,
            effective,
            end_date
      from  (
              select  emp_id,
                      dept_no,
                      effective,
                      lead(effective) over(partition by emp_id order by effective) - 1 end_date,
                      row_number() over(partition by emp_id order by effective) rn
                from  temp_activity
             union all
              select  emp_id,
                      null dept_no,
                      null effective,
                      min(effective) - 1 end_date,
                      0 rn
                from  temp_activity
                group by emp_id
      order by emp_id,
               rn
        EMP_ID    DEPT_NO EFFECTIVE  END_DATE
           101                       01/14/2001
           101       1000 01/15/2001 05/23/2005
           101       1050 05/24/2005 06/07/2008
           101       2010 06/08/2008 08/01/2010
           101       1000 08/02/2010
           102                       01/14/2001
           102       1040 01/15/2001 06/15/2006
           102       2000 06/16/2006
    8 rows selected.
    SQL> SY.

  • Parameter prompts-  Displaying task details between date range

    Hi all,
    I have created a report ( Crystal reports 2008) which lists task related details( distinct count) by region, customer and work type. I created two parameters to let the users specify the date ranges. Based on the user inputs, the title of the report would be " there are -- tasks between the user specified date ranges//-- and -//".  I am not sure how to go about displaying the title in the format specified.
    It would be great if you guys could give me your suggestions on this.
    Thanks a lot,
    Vinne
    Edited by: Vinnie_uic on Jun 8, 2010 9:32 AM

    Hi, I don't have 2008, but this should still work.
    You can add your text as shown.
    " there are   tasks between the user specified date ranges and  "
    Add your parameters to the report, also add a counter for your tasks.
    then you just drag and drop those into the title.
    When you edit the title it "May" look like this.
    "There are {@Count_of_Tasks}  tasks between the user specified date ranges {?Start_date} and {?End_Date} "
    but it should display as
    "There are 15  tasks between the user specified date ranges 5/20/2010  and 5/17/2010 "
    If that does not work for you, use the & sign, and create your formula like this.
    There are &" "& {@Count_of_Tasks}&" "&  tasks between the user specified date ranges &" "&{?Start_date} and&" "& {?End_Date}
    I hope the formatting is correct for 2008

  • Display date range with given week no

    Can anyone please suggest on how to display Date range when wek no is given in APEX 4.0.2?
    Example: given week no as 20 then I need to show week_start_date as 7/18/2011 and week_end_date as 7/25/2011 .
    Thanks

    maybe this could help you on the way to a solution:
    with dates as
        ( select dat, to_char(dat+1, 'iw') week
        from (select to_date('01-01-2011', 'DD-MM-YYYY') + rownum dat
        from all_objects)
        where rownum < 1000)
    select week, min(dat), max(dat)
    from dates
    where week = 20
    group by week
    order by week;You have to check which format for week you want to use: WW (first week starts at the 1st of January) IW (ISO week number)
    see also: http://asktom.oracle.com/pls/asktom/f?p=100:11:0::::P11_QUESTION_ID:7482139067917

Maybe you are looking for

  • Lightroom JPEG files far larger than equivalent Photoshop files?

    I'm using Lightroom 2.3 on a Mac. If I take an image and export it from Lightroom as a JPEG at the 60 quality setting, the resulting JPEG is typically around 2-3 times larger than the same file saved from Adobe Photoshop CS3 using the High Quality se

  • Mail account settings

    My email accounts are not being accepted on Ipad IOS. Gmail worked, but all others claim server incorrect even when identical settings to my MacBook. Any suggestions?

  • Strange grey area on right side of every page on IOS

    I'm having a weird problem, when I view this site on iphone/ipad there is a grey, sort of half-transparent area overlapping the outer right area of my site. I can't seem to find what causes this, I'd appreciate any help in this matter. http://neorate

  • Wrong purchased

    Hi,  I bought Pages, but it only can use in Ipad and Iphone not for the Mac.  Therefore, I paid twice for Pages. Can you return the Ipad and Iphone Pages($11.19) to me???? I only want to keep the Pages($19.99) for Mac.  Thx.

  • TA27468 Problem importing pictures with a Nikon D800 into a MacbookPro Retina

    I have this problem with a Nikon D800 when importing into a MacbookPro Retina ... I have enough free space, I can always import a batch of files from 10-100 (varying randomly), then get this "unreadable file" error message. Very frustrating.