/ 设置 10 秒超时 // 每日统计清 0 runtime_set('todaycomments', 0); runtime_set('todayarticles', 0); runtime_set('todayusers', 0); if ($forumlist) { $fidarr = array(); foreach ($forumlist as $fid => $forum) { $fidarr[] = $forum['fid']; } forum_update($fidarr, array('todayposts' => 0, 'todaythreads' => 0)); } // 清理临时附件 attach_gc(); // 当天24点 $today = strtotime(date('Ymd')) + 86400; runtime_set('cron_2_last_date', $today, TRUE); // 往前推8个小时,尽量保证在前一天 升级过来和采集的数据会很卡 // table_day_cron($time - 8 * 3600); cache_delete('cron_lock_2'); } } } ?>c# - How Do You Correctly Write an XML Request for CALDAV Client .NET - Stack Overflow|Concepts Of Algorithm

c# - How Do You Correctly Write an XML Request for CALDAV Client .NET - Stack Overflow

admin2025-04-19  2

I'm trying to access the events of an Apple Calendar. So far I was able to call PROPFIND and get the Principal User. Now my question is how do I use the principal user to find the server? I have the xml request. I just want to know how to add the Principal User to the request header?

I followed thislink

This is how they say to get the server link:

PROPFIND /200385701/principal/ HTTP/1.1
Host: caldav.icloud
Content-Type: application/xml; charset=utf-8
Authorization: Basic basicValue

<d:propfind xmlns:d="DAV:" xmlns:cal="urn:ietf:params:xml:ns:caldav" xmlns:cs="/">
  <d:prop>
    <cal:calendar-home-set/>
    <d:group-membership/>
  </d:prop>
</d:propfind>

This is my XML request string:

string xmlRequest2 = "<?xml version=\"1.0\" encoding=\"utf-8\"?><d:propfind xmlns:d=\"DAV:\" xmlns:cal=\"urn:ietf:params:xml:ns:caldav\" xmlns:cs=\"/\"><d:prop><cal:calendar-home-set/><d:group-membership/></d:prop></d:propfind>";

This is the method that I pass it into:

private string GetPrincipalServer(string username, string password, string calendarURI, string xmlRequest, string principalName)
{
    string principalServer = null;
    Stream ResponseStream;
    XmlDocument XmlDocument;
    WebHeaderCollection whc = new WebHeaderCollection();
    whc.Add(@"Translate", "F");

    ResponseStream = ExectueMethod(username, password, calendarURI, "PROPFIND", whc, xmlRequest, "text/xml");

    XmlDocument = new XmlDocument();
    XmlDocument.Load(ResponseStream);
    string xmlInner = XmlDocument.InnerXml;

    XmlDocument innerXmlDocument = new XmlDocument();
    innerXmlDocument.LoadXml(xmlInner);

    XmlNodeList lst = innerXmlDocument.GetElementsByTagName("href");
    principalServer = lst[lst.Count - 1].InnerText;
    ResponseStream.Close();
    return principalServer;
}

I think my code gets me part of the way there. I just don't know how to feed in the principal user which would actually give me the result that I need. In this example it is /200385701/principal/. So my question is how do I pass that into the header of my xml request?

转载请注明原文地址:http://conceptsofalgorithm.com/Algorithm/1745062809a282803.html

最新回复(0)